concept-collection / acoustic-scattering-2d
Add GitHub Pages deploy workflow
Checks out numbl (pinned to the commit this project was built against) as a sibling dependency, builds, and deploys dist/ to Pages.
Jeremy Magland <jmagland@flatironinstitute.org> committed commit 4cde0eb25a77 parent cbf6d88 Browse files
1 changed file+66−0
.github/workflows/deploy.ymladded+66−0View file
@@ -0,0 +1,66 @@
1+name: deploy
2+on:
3+ push:
4+ branches: [main]
5+ workflow_dispatch:
6+
7+permissions:
8+ contents: read
9+ pages: write
10+ id-token: write
11+
12+concurrency:
13+ group: pages
14+ cancel-in-progress: true
15+
16+jobs:
17+ build-deploy:
18+ runs-on: ubuntu-latest
19+ environment:
20+ name: github-pages
21+ url: ${{ steps.deployment.outputs.page_url }}
22+ steps:
23+ - uses: actions/checkout@v4
24+ - uses: actions/setup-node@v4
25+ with:
26+ node-version: 24
27+ cache: npm
28+ # numbl is a `file:../../numbl` dependency: we use its compiler internals
29+ # (parser, lowerer, IR, inline pass) and its interpreter, which its
30+ # published package `exports` do not expose. Clone it where that relative
31+ # path expects it. Pinned to the exact commit this project was built and
32+ # tested against, so CI builds exactly what was verified locally rather
33+ # than whatever numbl's main happens to be on the day it runs.
34+ #
35+ # numbl's own dependencies are NOT needed: the slice we import is
36+ # self-contained TypeScript, verified by building against a checkout with
37+ # no node_modules. One file in it is generated rather than committed,
38+ # though — the interpreter's stdlib bundle, which numbl gitignores — so a
39+ # bare checkout is missing it and `executeCode.ts` (used to evaluate scene
40+ # .m files on the CPU) fails to resolve it. Its generator only reads .m
41+ # files off disk, so plain `node` (type-stripping, unflagged since 22.18)
42+ # runs it without installing anything.
43+ - name: Check out numbl (sibling dependency)
44+ env:
45+ NUMBL_REF: 3901dbcbfa127240ee57a158184b2aa235478754
46+ run: |
47+ git clone --filter=blob:none --no-checkout \
48+ https://github.com/flatironinstitute/numbl.git "$GITHUB_WORKSPACE/../../numbl"
49+ git -C "$GITHUB_WORKSPACE/../../numbl" checkout --quiet "$NUMBL_REF"
50+ node "$GITHUB_WORKSPACE/../../numbl/scripts/bundle-stdlib.ts"
51+ # --ignore-scripts: npm runs a linked package's `prepare` script, and
52+ # numbl's is husky, which is not installed here.
53+ - run: npm ci --ignore-scripts
54+ # The checks compile MATLAB to compute shaders, so they need a GPU;
55+ # --skip-without-gpu lets this runner (which has none) say so and move on.
56+ - run: npm run test:node -- --skip-without-gpu
57+ - run: npm run build
58+ # Pages must already be enabled with "GitHub Actions" as the source; the
59+ # workflow token cannot create the site itself (`enablement: true` fails
60+ # with "Resource not accessible by integration").
61+ - uses: actions/configure-pages@v5
62+ - uses: actions/upload-pages-artifact@v3
63+ with:
64+ path: dist
65+ - id: deployment
66+ uses: actions/deploy-pages@v4