feat(ci): deploy to prod automatically on merge to main#3007
Open
cqnykamp wants to merge 4 commits into
Open
Conversation
Prod previously waited for CI to re-run on main and then blocked on a manual approval in the prod environment. Branch protection requires PRs to be up to date with main, so the merged tree is content-identical to what PR checks already tested — the re-run and the approval added latency without adding safety. - Trigger prod-deploy directly on push to main - Drop the approve job; nothing references the prod environment's protection rules anymore - Queue concurrent deploys instead of canceling in-progress ones, so a second merge can never kill a live deploy mid-rollout (GitHub keeps only the newest pending run, which contains all earlier merges) - Record deployments on the prod GitHub Environment via the Deployments API, mirroring dev3: in_progress at start, success/failure rollup after all three deploys, best-effort so bookkeeping never blocks a deploy - Remove the tag-prod job; the deployment record supersedes the force-pushed prod tag Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With deploys now automatic on merge, no human is in the loop when prod breaks. Write down the two rollback paths (revert PR, re-run last green Prod Deploy), the migration caveat that applies to both, and how to verify what prod is actually serving. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Makes production deployment fully automatic: merging a PR to main now deploys to prod immediately, with no CI re-run on main and no manual approval step.
Why this is safe: branch protection requires PR branches to be up to date with main, so the tree that lands on main is content-identical to what the PR's required checks already tested. Re-running CI on main and waiting for a human click added ~30–60 minutes of latency without adding information.
Changes
pushto main instead ofworkflow_runon CI completion; deploygithub.shadirectly.approvejob. Nothing references theprodenvironment's protection rules anymore, so deploys can't be gated by them. (Follow-up for repo settings: the required-reviewer rule on theprodenvironment is now inert and can be removed.)cancel-in-progress: false. Merging PR B while PR A's ~10-minute deploy is mid-flight previously canceled A mid-S3-sync / mid-ECS-rollout — potentially killing the rollback logic itself. Now A finishes, and GitHub queues only the newest pending run (which, per branch protection, contains every earlier merge). Intermediate pending runs are superseded before they start, which is harmless.in_progressat start, finalize with a success/failure rollup (per-component results in the description) after backend/frontend/site complete. Bookkeeping is best-effort and no deploy job depends on it, so an API hiccup can never block or skip a deploy. On success GitHub auto-inactivates the previous record, so the Environments tab always shows what's live.tag-prodjob. The deployment record supersedes the force-pushedprodtag (nothing in the repo reads it). The stale tag on the remote can be deleted separately:git push origin :refs/tags/prod.Operational notes
check+ alle2e-tests,e2e-brittle-tests,component-testsmatrix entries) and that direct pushes to main are blocked, since any push to main now ships.🤖 Generated with Claude Code