Build and publish the site from the vault's CI on every push to main
3 changed files+66−0
.cofferdam/workflows/deploy.ymladded+42−0View file
@@ -0,0 +1,42 @@
1+# Build the page and publish it as this repository's site, on every push to
2+# main. The site lands at /tutorials/laplace-dirichlet/site/.
3+#
4+# Two cofferdam-specific points. `actions/cache` is not implemented, so
5+# `setup-node` must not be given `cache: npm`; the install is done cold every
6+# run. And the site is served from a sub-path rather than a domain root, which
7+# is why vite.config.ts sets `base: './'` — the build emits relative URLs and
8+# needs no base path passed in.
9+name: site
10+
11+on:
12+ push:
13+ branches: [main]
14+ workflow_dispatch:
15+
16+concurrency:
17+ group: site
18+ cancel-in-progress: false
19+
20+jobs:
21+ build:
22+ runs-on: ubuntu-latest
23+ steps:
24+ - uses: actions/checkout@v4
25+
26+ - uses: actions/setup-node@v4
27+ with:
28+ node-version: 22
29+
30+ # puppeteer is only used by scripts/browser-test.mjs, which does not run
31+ # here; skip the ~150 MB Chrome download
32+ - run: npm ci
33+ env:
34+ PUPPETEER_SKIP_DOWNLOAD: "true"
35+
36+ - run: npm run build
37+
38+ - uses: actions/upload-pages-artifact@v3
39+ with:
40+ path: dist
41+
42+ - uses: actions/deploy-pages@v4
CLAUDE.mdmodified+14−0View file
@@ -160,6 +160,20 @@ To look at them, point a headless browser at each chapter and screenshot
160160 `figure.static-figure`; `npm run test:browser --shots` writes whole pages, which is
161161 coarser but needs no extra script.
162162
163+## Deployment
164+
165+`.cofferdam/workflows/deploy.yml` runs on every push to `main`: `npm ci`,
166+`npm run build`, then `upload-pages-artifact` and `deploy-pages`, which the
167+vault substitutes with its own implementations to publish the repository's
168+site. Two constraints shape it. `actions/cache` is not implemented in the
169+vault's CI, so `setup-node` must not be given `cache: npm`. And a vault site is
170+served sandboxed, in an opaque origin, so `localStorage` and friends *throw*;
171+the app uses none, and adding one would break the deployed page while working
172+perfectly in `npm run dev`.
173+
174+Watch a deploy with `cofferdam run list --limit 3 --json` and
175+`cofferdam run view <n> --log`.
176+
163177 ## Plotting
164178
165179 `src/plot/` is a small SVG layer with no chart library. `palette.ts` records which
README.mdmodified+10−0View file
@@ -110,6 +110,16 @@ takes `--shots` to write a full-page screenshot of each chapter into `tmp/`.
110110 See [CLAUDE.md](CLAUDE.md) for how the pieces fit together, and in particular for the
111111 numbl performance rules that the drivers are written around.
112112
113+## Deployment
114+
115+`.cofferdam/workflows/deploy.yml` builds the page on every push to `main` and
116+publishes it as the repository's site on the vault, at
117+`/tutorials/laplace-dirichlet/site/`. The build is a plain `npm ci && npm run
118+build`; `vite.config.ts` uses a relative `base`, so the sub-path needs no
119+configuration. Note that the vault serves sites sandboxed, which makes
120+`localStorage` throw rather than degrade: nothing here touches it, and nothing
121+here should start.
122+
113123 ## Licence
114124
115125 Apache-2.0.