refactor(ci): deduplicate deploy workflows#3008
Open
cqnykamp wants to merge 5 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>
The three deploy entry points (push to main -> dev3, /deploy-dev PR command, push to main -> prod) each repeated two things: the backend/frontend/site fan-out with its per-environment constants, and the GitHub deployment bookkeeping bash, which had already drifted between copies (lights-out handling, prod badge). - reusable-deploy-env.yml: single definition of a deploy — resolves per-environment constants (account, role, ECR repo, cluster, SNS topic, tag) from env_name and fans out to the three component workflows; exposes per-component results as outputs - actions/open-deployment: open a deployment record and mark it in_progress; best-effort, never fails the job - actions/finalize-deployment: set the final status from the three component results, with an optional lights-parameter input that records success-while-asleep as inactive (dev3 only) - callers shrink to trigger/gate logic plus one deploy job each No behavior change intended for any of the three entry points. 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
The three deploy entry points (
dev-deploy.yml,dev-deploy-pr.yml,prod-deploy.yml) each repeated two things:production_environmentbadge in prod).No behavior change intended for any entry point.
Changes
reusable-deploy-env.yml— the single definition of what "a deploy" is. Takesdeploy_ref+env_name, resolves all per-environment constants in oneconfigjob (the only place the two AWS accounts are named), fans out to the three existing component workflows, and exposesbackend_result/frontend_result/site_resultas outputs. Callers shrink to trigger/gate logic plus onedeployjob. Adding a component or a smoke-test to "a deploy" is now a one-file edit..github/actions/open-deployment— opens a deployment record and marks itin_progress. Best-effort: never fails the job; emptydeployment_idoutput means "no record, skip finalize".production-environmentinput covers prod's badge..github/actions/finalize-deployment— sets the final status from the three component results. The dev-only lights-out logic became an optionallights-parameterinput: when set, a successful deploy while the environment is asleep is recorded asinactive; when unset (prod), plain success/failure. Any SSM read failure degrades to "treat as awake", which matches the oldHAVE_AWSfallback.Notes for review
actions/checkoutsteps. Indev-deploy-pr.ymlthe checkout is conditioned on actually deploying, andissue_commentchecks out the default branch, so the gate still never runs PR-controlled code.deployed to prod/dev3 deploy failed (backend:… frontend:… site:…)), matching the previous per-copy strings.dev-deploy-pr.ymlruns from the default branch onissue_comment, so its changes only take effect after merge. The push/dispatch paths can be exercised beforehand viagh workflow run dev-deploy.ymlon this branch.🤖 Generated with Claude Code