Harden production deploy pipeline (GitHub Actions deploy + pre-merge guard) - #1
Merged
Merged
Conversation
Adds a `[build.environment]` block setting `NODE_VERSION = "24.1.0"` so the Netlify-side build (now secondary to GitHub Actions deploy) uses the same Node we declare in .nvmrc and package.json#engines. This is defence-in-depth: even if the primary GH Actions deploy path is bypassed and a stray Netlify auto-build runs, it boots the right Node. Context: the June 2026 `noble` build-image rollout silently broke Netlify auto-deploys for ~7 weeks. Subsequent work in this branch moves production deploys to GitHub Actions so the noble incompatibility is no longer in the critical path. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds a `netlify-build-check` job that runs `netlify build --offline` on every PR after `verify` passes. This simulates Netlify Build's pipeline (executing netlify.toml's build command and bundling functions) so we catch Netlify-Build-specific regressions before they merge to main. Why we need this: the June 2026 `noble` image rollout silently broke auto-deploys for ~7 weeks because nothing failed in our PR pipeline. Running `netlify build` in CI surfaces that class of failure on the PR. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds a `deploy-production` job that becomes the source of truth for
production deploys. The job:
1. Waits for `verify` and `netlify-build-check` to pass
2. Waits for `migrate-production` (when configured) so the schema is
ready before the new Lambda boots
3. Builds with Node pinned via `.nvmrc` (`actions/setup-node@v4`)
4. Generates the Prisma client against the current schema
5. Runs `netlify deploy --prod --skip-functions-cache` so the function
bundle is always fresh (no stale cached Prisma client)
6. Smoke-checks the live API and fails the job if it does not 200
Gated by NETLIFY_AUTH_TOKEN + NETLIFY_SITE_ID via a
`check-production-deploy` job (secrets cannot be referenced in
job-level `if:`).
Background: Netlify's own git auto-deploy has been failing silently on
the `noble` build image since the June 2026 rollout, leaving production
on the April 28 Lambda for ~7 weeks. Moving the deploy into GitHub
Actions gives us full logs, pinned Node, and a built-in smoke check, so
a future Netlify image regression no longer takes the site down.
Requires GitHub secrets: NETLIFY_AUTH_TOKEN, NETLIFY_SITE_ID (both set
out-of-band when this commit lands).
Co-authored-by: Cursor <cursoragent@cursor.com>
- ARCHITECTURE.md §15.4: new section describing the verify → netlify-build-check → migrate → deploy pipeline, the required GitHub secrets, the --skip-functions-cache requirement, and the live-API smoke check - ARCHITECTURE.md "Destructive Migrations And The Deploy Race": updated to reflect that migrate and deploy are now sequenced in the same workflow, noting the residual race only exists while Netlify's git auto-deploy stays on as a fallback - AGENTS.md §3 "Production Deploy Pipeline": ops rules for deploys, rollback guidance (prefer restoreSiteDeploy), and the required GitHub secrets contract Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jun 14, 2026
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
Move production deploys to GitHub Actions so the Netlify
noblebuild-image rollout (June 2026) and similar future regressions stop being a single-point-of-failure that takes the site offline. Netlify's git auto-deploy had been silently failing for ~7 weeks before we noticed.What this PR adds
netlify.toml—[build.environment] NODE_VERSION = "24.1.0"(commit 85a5091). Defence-in-depth so even the now-secondary Netlify-side build path boots the right Node.netlify-build-check(commit 049e006). Runsnetlify build --offlineon every PR. Future Netlify-Build regressions show up as a red PR check, not as a silent 7-week outage.deploy-productionjob (commit 0223efe). New source of truth for prod deploys:verify+netlify-build-check+migrate-production.nvmrc+actions/setup-node@v4npm ci→db:generate→build→netlify deploy --prod --skip-functions-cache/api/tournaments?status=active,upcoming; fails the workflow if prod doesn't 200NETLIFY_AUTH_TOKEN+NETLIFY_SITE_ID(already set as repo secrets)docs/ARCHITECTURE.md§15.4 describes the full pipeline, secrets contract, and the--skip-functions-cacherequirement.AGENTS.md§3 adds deploy ops rules and rollback guidance.Why each piece
netlify-build-checkon every PR → red CI--skip-functions-cachemandatoryclosingDaterace (DB dropped, Lambda still selecting it)deploy-productionneeds: migrate-production, ordered explicitlySecrets configured (out of band)
NETLIFY_AUTH_TOKEN— set 2026-06-14NETLIFY_SITE_ID— set 2026-06-14PRODUCTION_DATABASE_URL— pre-existingRESULTS_IMPORT_API_KEY— added to Netlify project env (not a GH secret; the Lambda needs it)NODE_VERSION— added to Netlify project env (24.1.0)Open follow-up (intentionally not in this PR)
Once we've seen the first GH Actions
deploy-productionrun go green onmain, we can disable Netlify's git auto-deploy (skip_automatic_builds = truevia Netlify API) to remove the duplicated/failing parallel build. Leaving it on for one merge cycle as a safety net.Test plan
npm run verifypasses locally (38 tests, build clean)verifyandnetlify-build-checkgreen on this PRdeploy-productionjob runs onmain/api/tournaments?status=active,upcoming) returns 200ci: <sha7> (main))Made with Cursor