Deploy releases via wrangler instead of a watched branch#131
Open
TheMeinerLP wants to merge 1 commit into
Open
Deploy releases via wrangler instead of a watched branch#131TheMeinerLP wants to merge 1 commit into
TheMeinerLP wants to merge 1 commit into
Conversation
Replaces the branch-promotion approach (promote-release.yml) added in #124. Promoting a `release` branch only works if Workers Builds' Git integration deploys that branch — but production needs to ship via an explicit deploy command instead. This workflow runs on every `v*` tag (the tags release-please cuts when its release PR is merged), builds with the cloudflare_module preset and deploys with `wrangler deploy`. Nitro's cloudflare_module preset with deployConfig:true emits wrangler.json plus the worker entry into .output/, so the cloudflare/wrangler-action runs `deploy` from that directory with no extra flags; the D1 binding and vars come from the generated config. One-time setup (documented in the PR): - Pause/disable the Workers Builds Git integration so it does not also deploy on every push to main. - Add repo secrets CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID. Net flow unchanged from the intent of #124: push to main -> preview only; merge release PR -> tag -> this workflow builds and deploys production. Only the deploy mechanism changes (wrangler deploy instead of a branch Cloudflare watches).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
launchpad | 040bfb9 | Commit Preview URL Branch Preview URL |
May 15 2026, 10:35 PM |
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.
Summary
Follow-up to #124 (merged). #124 added
promote-release.yml, which fast-forwarded areleasebranch on everyv*tag and relied on Cloudflare Workers Builds' Git integration to deploy that branch. That only works if Workers Builds watchesrelease— but production needs to ship via an explicit deploy command instead.This PR swaps
promote-release.ymlfordeploy-release.yml: on everyv*tag (the tags release-please cuts when its release PR is merged), build with thecloudflare_modulepreset and deploy withwrangler deploy.The release-please setup from #124 is untouched — only the deploy mechanism changes.
What changes
v*tagv*tag (unchanged)releasebranch, Workers Builds deploys itwrangler deployreleaseCLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_IDPipeline after merge
Nitro's
cloudflare_modulepreset withdeployConfig: trueemitswrangler.jsonplus the worker entry into.output/, socloudflare/wrangler-actionrunsdeployfrom that directory with no extra flags. The D1 binding (DB→launchpad) andvarscome straight from the generated config.main. (Optional: keep it enabled for non-production preview builds if you want PR previews — just make sure it does not target production.)CLOUDFLARE_API_TOKEN— a token with Workers Scripts:Edit + the account's D1:Edit scopeCLOUDFLARE_ACCOUNT_IDpromote-release.ymlalready created areleasebranch from Adopt release-please + tag-gated production deploys #124, it can be deleted — nothing references it anymore.Until step 2 is done, the workflow runs on a tag but the deploy step fails (missing secrets); the build step still validates.
Test plan
CLOUDFLARE_API_TOKEN+CLOUDFLARE_ACCOUNT_IDaddedmainv*tag is pusheddeploy-release.ymlruns:pnpm buildsucceeds,wrangler deploypublishes from.output/appConfig.versionmatches the tag)maindoes not deploy productionGenerated by Claude Code