-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure publishing to github pages (#20)
* Configure publishing to github pages
- Loading branch information
1 parent
9391ccb
commit ea90729
Showing
9 changed files
with
141 additions
and
3 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 |
---|---|---|
|
@@ -46,4 +46,5 @@ runs: | |
name: build-artifacts | ||
path: | | ||
tools/**/build/* | ||
github-pages-publisher/build/* | ||
if-no-files-found: error |
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
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,31 @@ | ||
name: delete preview on PR close | ||
|
||
# only trigger on pull request closed events | ||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete_preview: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
steps: | ||
- name: make empty dir | ||
run: mkdir empty-dir | ||
|
||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./empty-dir | ||
destination_dir: ${{ env.PR_PATH }} | ||
|
||
- name: Comment on PR | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "🪓 PR closed, deleted preview at https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" |
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
persist-credentials: false | ||
|
||
- name: "NPM Install, Build, and Cache" | ||
|
@@ -32,6 +33,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
persist-credentials: false | ||
|
||
- name: "Retrieve Dependencies and Build Artifacts" | ||
|
@@ -49,6 +51,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
persist-credentials: false | ||
|
||
- name: "Retrieve Dependencies and Build Artifacts" | ||
|
@@ -66,6 +69,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
persist-credentials: false | ||
|
||
- name: "Retrieve Dependencies and Build Artifacts" | ||
|
@@ -75,6 +79,42 @@ jobs: | |
- name: Lint | ||
run: npm run lint-all | ||
|
||
publish-gh-pages: | ||
name: Publish GitHub Pages | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
persist-credentials: false | ||
|
||
- name: "Retrieve Dependencies and Build Artifacts" | ||
id: retrieve-deps-and-build | ||
uses: ./.github/actions/retrieve-deps-and-build | ||
|
||
- name: Set base URL for preview if PR | ||
run: echo "BASE_URL=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH }}/" >> $GITHUB_ENV | ||
|
||
- name: Deploy to PR preview | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./github-pages-publisher/build | ||
destination_dir: ${{ env.PR_PATH }} | ||
|
||
- name: Add PR Preview comment | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | ||
|
||
summary: | ||
name: Summary | ||
needs: [build, test, type-check, lint] | ||
|
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,3 @@ | ||
<a href="tools/gltf-avatar-exporter/"> | ||
GLTF Avatar Exporter | ||
</a> |
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,10 @@ | ||
{ | ||
"name": "github-pages-publisher", | ||
"private": true, | ||
"scripts": { | ||
"build": "./publish.sh" | ||
}, | ||
"devDependencies": { | ||
"@mml-io/gltf-avatar-exporter": "file:../tools/gltf-avatar-exporter" | ||
} | ||
} |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit on error and echo each command | ||
set -ex | ||
|
||
# Set the working directory to the location of this script | ||
cd "$(dirname "$0")" | ||
|
||
# Create the build directory | ||
mkdir -p ./build/tools | ||
|
||
# Copy the index.html file that references the different tools into the build directory | ||
cp ./index.html ./build/index.html | ||
|
||
# Copy the files for each tool into the build directory | ||
cp -r ../tools/gltf-avatar-exporter/build ./build/tools/gltf-avatar-exporter |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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