forked from mohsin-r/ramp4-editor
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from mohsin-r/demo-builds
Add demo builds via actions
- Loading branch information
Showing
7 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
name: Bug report | ||
about: Submit a grouse | ||
title: '' | ||
labels: 'flavour: bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
[ This is just a template. You can delete any section that does not apply to the issue. ] | ||
|
||
## Description | ||
|
||
[ Provide a clear and detailed explanation of the issue. ] | ||
|
||
## Environment | ||
|
||
- Browser (if applicable): [ e.g., Chrome 92, Firefox 89 ] | ||
- Versions (all that apply to bug): | ||
- Browser: [ e.g. Chrome 99 ] | ||
- RAMP Build: [ e.g. 4.0.1-beta [89b9eb544] ] | ||
- NodeJS: [ e.g. 14.17.3 ] | ||
- Any other relevant environment details | ||
|
||
## Screenshots | ||
|
||
[ If applicable, include screenshots or gifs that help visualize the issue. ] | ||
|
||
## Steps to reproduce | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
## Expected behavior | ||
|
||
[ Clearly describe what you expected to happen. ] | ||
|
||
## Actual behavior | ||
|
||
[ Describe what actually happened. ] | ||
|
||
## Additional information | ||
|
||
[ Include any other relevant information, such as error messages, logs, related issues, and things you've tried. ] | ||
|
||
## Possible solution | ||
|
||
[ If you have any ideas on how to solve the issue, share them here. It's okay if you don't have a solution yet. ] | ||
|
||
## Related issues | ||
|
||
[ List any related issues or pull requests that might be connected to this issue. ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea | ||
title: '' | ||
labels: 'flavour: feature' | ||
assignees: '' | ||
|
||
--- | ||
|
||
[ This is just a template. You can delete any section that does not apply to the request. ] | ||
|
||
## Description | ||
|
||
[ Provide a detailed description of the feature you'd like to request. ] | ||
|
||
### Is your feature request related to a problem? | ||
|
||
[ Explain the problem it would solve or the value it would add to the project. E.g. "I'm always frustrated when X happens" ] | ||
|
||
## Proposed solution | ||
|
||
[ Provide a clear description of what you want to happen. ] | ||
|
||
## Alternatives considered | ||
|
||
[ If you have any ideas on how this feature could be implemented, share them here. You can also include design suggestions, technical details, or workflow considerations. ] | ||
|
||
## Additional context | ||
|
||
[ Add any other context or screenshots about the feature request here. ] | ||
|
||
## Related Issues | ||
|
||
[ List any related issues, pull requests, or discussions that might be related to this feature request. ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### Related Item(s) | ||
*#Item 1*, *#Item 2* | ||
|
||
### Changes | ||
- [FEATURE] *Describe feature...* | ||
- [FIX] *Describe fix...* | ||
- [DOCS] *Describe docs changes...* | ||
- [REFACTOR] *Describe refactor...* | ||
|
||
### Notes | ||
*Additional comments about the changes in this PR, including screenshots/gifs* | ||
|
||
### Testing | ||
Steps: | ||
1. ... | ||
2. ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Install and build | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
install-build: | ||
name: Install and build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if contributor is an org member | ||
id: is_organization_member | ||
if: github.event_name == 'pull_request_target' | ||
uses: JamesSingleton/[email protected] | ||
with: | ||
organization: ramp4-pcar4 | ||
username: ${{ github.event.pull_request.head.user.login }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Output comment and end build if not org member | ||
if: github.event_name == 'pull_request_target' | ||
run: | | ||
result=${{ steps.is_organization_member.outputs.result }} | ||
if [ $result == false ]; then | ||
user=${{ github.event.pull_request.head.user.login }} | ||
echo Either ${user} is not part of the ramp4-pcar4 organization | ||
echo or ${user} has its Organization Visibility set to Private at | ||
echo https://github.com/orgs/ramp4-pcar4/people?query=${user} | ||
exit 1 | ||
fi | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref || github.ref_name }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | ||
|
||
- name: Setup Node version | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.16.0 | ||
|
||
- name: Install and build | ||
run: | | ||
npm ci | ||
npm run build | ||
- name: Cache dist files | ||
uses: actions/cache@v3 | ||
with: | ||
path: dist | ||
key: dist-${{ github.event.pull_request.head.sha || github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
pull_request_target: | ||
types: [opened, synchronize] | ||
|
||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build: | ||
name: Install dependencies and build | ||
uses: ./.github/workflows/build.yml | ||
|
||
deploy: | ||
needs: [build] | ||
name: Deploy files | ||
uses: ./.github/workflows/pages.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Cleanup GitHub pages | ||
|
||
on: | ||
pull_request_target: | ||
types: [closed] | ||
|
||
jobs: | ||
cleanup-pages: | ||
name: Delete demo page when PR closed | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'gh-pages' | ||
|
||
- name: Delete files | ||
shell: bash | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Yi Lei Feng" | ||
git rm -r ${{ github.head_ref }}/* | ||
git commit -a -m 'Delete PR demo from GH pages ${{ github.head_ref }}' | ||
git push origin HEAD:gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish to GitHub pages | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
deploy-to-pages: | ||
name: Deploy to GitHub pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get dist files | ||
uses: actions/cache@v3 | ||
with: | ||
path: dist | ||
key: dist-${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: dist | ||
target-folder: ${{ github.head_ref || github.ref_name }} | ||
|
||
- name: Post demo link comment | ||
uses: actions/github-script@v6 | ||
if: github.event_name == 'pull_request_target' && github.event.action == 'opened' | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `Your demo site is ready! 🚀 Visit it here: https://${{github.repository_owner}}.github.io/storylines-editor/${{github.head_ref}}` | ||
}) |