-
Notifications
You must be signed in to change notification settings - Fork 8
74 lines (66 loc) · 2.88 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: LeapShape - 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