Repository navigation
Deploy main via Workers Builds, with a GitHub Actions fallback - #1
Merged
Merged
Conversation
Pushes to main never reached production: the Worker had no Workers Builds
trigger and CI deliberately does not deploy. This adds the pieces for the
same two-path setup rx and pid1.github.io use.
- build.sh stages public/ into dist/ and writes the checked-out commit to
dist/.build-id. wrangler.toml's [build] runs it before `wrangler dev` and
`wrangler deploy`, and the assets directory moves to ./dist.
- public/_headers serves /.build-id with Cache-Control: no-store. Static
assets are served before the Worker runs, so the header has to come from
_headers rather than from a handler in the router.
- .github/workflows/cf-fallback.yml waits 600s, reads ${SITE}/.build-id, and
only if the live commit is not github.sha runs typecheck, tests and
`wrangler deploy`. It skips docs-only pushes.
The Workers Builds connection itself is made in the dashboard. Neither path
touches runtime secrets, which deploys keep, or D1 migrations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANZvTxc4uANFhddTwYq4TH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pushes to
mainnever deployed scram: the Worker has no Workers Builds trigger. This adds what the rx / pid1.github.io pattern needs.build.shcopiespublic/todist/and writes the commit todist/.build-id.[build]inwrangler.tomlruns it automatically; assets now come from./dist.public/_headersserves/.build-idwithCache-Control: no-store. It has to be_headersbecause assets are served before the Worker runs..github/workflows/cf-fallback.ymlsleeps 600 s, compareshttps://scram.pid1.space/.build-idwithgithub.sha, and only if they differ runs typecheck + tests +wrangler deploy. Docs-only pushes are skipped. Actions are pinned to SHAs,permissions: {},persist-credentials: false.Checked locally: typecheck, 38/38 tests, actionlint,
wrangler deploy --dry-run, andwrangler dev(/.build-idreturns the SHA withno-store;/,/healthcheckand/api/*behave as before).Before or right after merging
pid1/scram, branchmain, root/, build commandnpm run typecheck && npm test, deploy commandnpx wrangler deploy. No build variables needed.CLOUDFLARE_API_TOKEN(Workers Scripts: Edit) andCLOUDFLARE_ACCOUNT_ID. Until you add them, the fallback fails whenever it decides to deploy. The live site serves no/.build-idyet, so the first push will always look stale to it.Neither path applies D1 migrations or touches runtime secrets.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ANZvTxc4uANFhddTwYq4TH