Skip to content

ci(deploy-web): only the branch head deploys, and every build says which commit it is (#1051) - #1077

Merged
thinkclay merged 1 commit into
mainfrom
ci/deploy-web-latest-wins
Oct 8, 2026
Merged

thinkclay merged 1 commit into
mainfrom
ci/deploy-web-latest-wins

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #1051.

The bug

deploy-web.yml runs each check out their own event SHA and finish in whatever order they finish, so the last one to finish owns the alias. On 2026-10-06 an older push finished after a newer one and rolled dev back to before #1050's fix. Nothing noticed: the smoke test only checks for HTTP 200, and the entry hash doesn't change when only a route chunk does.

Fix: both acceptance options, belt and braces

deploy-web.yml (dev and preview)

  • 🧭 Only the branch head deploys: right before eas deploy, the run compares its SHA with origin/<branch>. A run that's no longer the head skips the deploy with a notice, and the summary says so.
  • A commit stamp: after the export, the build writes dist/client/build.json with {commit, ref, target, builtAt}, served at /build.json.
  • 🔖 Deployed build is this commit: not continue-on-error. It polls /build.json for up to 2 minutes until it serves this SHA. If a newer head has already replaced it, that's fine and it says so. Anything else fails the run.

scripts/deploy-web-eas.sh (prod and manual deploys)

Tested

result
stamp written + sed extraction the extracted commit matches the commit stamped (tested with f80ec114d)
/build.json from dist/client 200 application/json (local expo serve)
script, dirty tree exits 2 before building; lists the changes
script, --skip-build with dist stamped f80ec114d, HEAD a2dce8a06 exits 2; never reaches the EAS upload

One finding while testing: local expo serve 404s any static file with a query string (/robots.txt?cb=1), though EAS Hosting doesn't (dev.scaffald.com/robots.txt?cb=… is a 200). So the checks fetch /build.json with no cache-buster.

Not yet proven: the workflow steps themselves. That needs a real push to main. After merge I'll check the run's head-guard and commit-check steps and dev.scaffald.com/build.json.

🤖 Generated with Claude Code

…ich commit it is (#1051)

deploy-web.yml runs check out their own event SHA and finish in any order,
so an older push could take the dev alias after a newer one and roll dev
back (2026-10-06: dev lost #1050's fix). Now:

- A 'branch head' step compares the checked-out SHA with origin/<branch>
  just before eas deploy; an older run skips the deploy with a notice.
- The build writes dist/client/build.json {commit, ref, target, builtAt},
  served at /build.json.
- A 'deployed build is this commit' step (not continue-on-error) polls
  /build.json until it serves this SHA, or the newer head, else fails.

scripts/deploy-web-eas.sh (prod) gets the same stamp, refuses a dirty
working tree (#1073: an uncommitted edit shipped that way) and a
--skip-build whose dist was stamped from another commit, and checks the
per-deploy EAS URL's /build.json after the upload.

Closes #1051

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thinkclay
thinkclay merged commit 5dfbe88 into main Oct 8, 2026
10 checks passed
@thinkclay
thinkclay deleted the ci/deploy-web-latest-wins branch October 8, 2026 16:59
thinkclay added a commit that referenced this pull request Oct 13, 2026
…lias six minutes (#1051) (#1078)

The first real run of #1077's commit check (37813067368) failed while the
deploy was correct: the dev alias took over two minutes to move to the new
deployment, so /build.json kept 404ing from the previous one. dev served
the new stamp shortly after.

The check now reads /build.json from the per-deploy URL in the eas deploy
output (the deployment itself, correct at once; the alias URL is excluded)
and fails if that is wrong; then polls the alias for up to 6 minutes,
reporting how long it took. The deploy step runs with shell: bash so the
tee keeps pipefail.

Co-authored-by: Claude Opus 5.5 <[email protected]>
thinkclay added a commit that referenced this pull request Oct 13, 2026
…loudFront, not a bare CNAME (#1051) (#1079)

#1078's merge run (38410783002) deployed correctly — the per-deploy URL
check passed for c37da27 — then failed the alias wait: dev.scaffald.com
kept serving 5dfbe88's build.json for the whole 6 minutes. Not lag:
dev.scaffald.com is behind CloudFront (x-cache: Hit from cloudfront,
age 436) and EAS sends max-age=3600 for static files, so CloudFront held
the old /build.json for an hour. scf-scaffald--dev.expo.app had the new
one; dev.scaffald.com/build.json?x=… (a cache miss) did too.

The query string is CloudFront's cache key, so both the CI check and the
prod script now fetch /build.json?v=<sha>-<random>. #1077 dropped the
cache-buster because local expo serve 404s static files with a query; the
real hosts do not. The workflow comment claiming dev/preview CNAME straight
to EAS is corrected.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(deploy-web): a queued deploy for an older main commit can finish after a newer one and roll dev back

1 participant