Skip to content

Commit 44aa7b0

Browse files
committed
Stamp build-info after tests so the dev-sentinel guards can run in CI
1 parent d648ad2 commit 44aa7b0

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,28 @@ jobs:
4444
# is load-bearing, not style — spec overview §Step 4).
4545
- run: npm run lint
4646

47+
# Regenerates the tracked `public/styles.css` asset so the uploaded
48+
# stylesheet matches this build. Never committed back.
49+
- run: npm run build:css
50+
51+
# `check` and `test` run against the COMMITTED `'dev'` placeholder,
52+
# BEFORE the stamp below. This ordering is load-bearing, not style:
53+
# the dev-sentinel tests (footer renders plain unlinked text, /verify
54+
# omits its provenance line, GET /version returns `dev`) are the guard
55+
# that a non-CI build never claims provenance. They assert against the
56+
# real committed file on purpose — that is also what catches a real SHA
57+
# accidentally committed into src/build-info.ts. Stamping first would
58+
# make those four tests unrunnable in CI by construction.
59+
- run: npm run check
60+
61+
- run: npm test
62+
4763
# Overwrites the committed `'dev'` placeholder with this run's real
4864
# provenance, IN THE RUNNER ONLY — never committed back (`permissions:
49-
# contents: read` above has no write scope to do so anyway). Runs
50-
# BEFORE `check`/`test` below: the bytes that get typechecked and
51-
# tested must be the exact bytes that get uploaded, or a stamp-time
52-
# regression could ship untested.
65+
# contents: read` above has no write scope to do so anyway). Last
66+
# mutation before upload: the only delta from the tested tree is this
67+
# one three-field constant, and a malformed stamp fails the deploy
68+
# step's own bundle rather than shipping.
5369
# The type annotation is intentional and must match src/build-info.ts's
5470
# committed shape exactly: an explicit `{ readonly ...: string }`
5571
# object type, not `as const`. Without it, this real-SHA rewrite would
@@ -67,14 +83,9 @@ jobs:
6783
};
6884
EOF
6985
70-
# Regenerates the tracked `public/styles.css` asset so the uploaded
71-
# stylesheet matches this build. Runs before `check`/deploy for the
72-
# same reason as the stamp above — never committed back.
73-
- run: npm run build:css
74-
75-
- run: npm run check
76-
77-
- run: npm test
86+
# Typecheck the stamped file before upload — cheap, and it is the only
87+
# thing between the stamp and production.
88+
- run: npm run typecheck
7889

7990
- uses: cloudflare/wrangler-action@v3
8091
with:

0 commit comments

Comments
 (0)