-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
74 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,74 @@ | ||
name: LeapMotionWebXR - Build Site | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Rebuild Site | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
with: | ||
lfs: true | ||
|
||
# Ideally this makes the next step run faster | ||
# But I haven't noticed a speed difference | ||
# May want to cache the ./node_modules directory directly... | ||
- name: Cache Node Modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install Node Modules | ||
run: npm install | ||
|
||
# Switching the HTML entrypoint over to the build | ||
# and compensating for the fact that | ||
# Safari and Firefox can't use modules in WebWorkers | ||
# but ESBuild can't NOT use modules in WebWorkers! | ||
- name: Pre-Process Site | ||
run: | | ||
sed -e 's/.\/src\//\/build\//g' index.html > index.html.tmp | ||
mv index.html.tmp index.html | ||
sed -e 's/\/\/import /import /g' src/Backend/mainWorker.js > src/Backend/mainWorker.js.tmp | ||
mv src/Backend/mainWorker.js.tmp src/Backend/mainWorker.js | ||
sed -e 's/importScripts/\/\/importScripts/g' src/Backend/mainWorker.js > src/Backend/mainWorker.js.tmp | ||
mv src/Backend/mainWorker.js.tmp src/Backend/mainWorker.js | ||
sed -e 's/\/\/import /import /g' src/Backend/OpenCascadeMesher.js > src/Backend/OpenCascadeMesher.js.tmp | ||
mv src/Backend/OpenCascadeMesher.js.tmp src/Backend/OpenCascadeMesher.js | ||
sed -e 's/importScripts/\/\/importScripts/g' src/Backend/OpenCascadeMesher.js > src/Backend/OpenCascadeMesher.js.tmp | ||
mv src/Backend/OpenCascadeMesher.js.tmp src/Backend/OpenCascadeMesher.js | ||
sed -e 's/\/\/export /export /g' src/Backend/OpenCascadeMesher.js > src/Backend/OpenCascadeMesher.js.tmp | ||
mv src/Backend/OpenCascadeMesher.js.tmp src/Backend/OpenCascadeMesher.js | ||
- name: Run esbuild | ||
run: npm run build | ||
|
||
- name: Commit the Updated Build Artifacts | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Actions" | ||
git add build | ||
git add index.html | ||
git diff-index --quiet HEAD || git commit -m "Rebuild Site" | ||
# Force Push from main to gh-pages... | ||
# This means there is no history being accumulated | ||
- name: Push Changes to branch | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: gh-pages | ||
force: true |