00006 — GitHub Workflow Architecture

By Engineering Team•November 30, 2026•5 min read

Implements ADR-005 against SR-005 and BRD-005. This page owns how a release moves. The steps inside each workflow are in 00003 — App Pipeline and 00004 — Infrastructure Pipeline, and which job reads which value in 00005 — Access Boundaries.


1. Overview

Workflow architecture: feature branches merge into dev for testing, dev and hotfix branches reach main by pull request; nothing runs by itself; when deploy code changed a person runs infra.yml plan then apply for nonprod, then plan and apply for prod with the same SHA; a person runs app.yml for nonprod, which scans, builds, stores and deploys, then for prod, which scans, builds, compares with the stored nonprod build and deploys; the site and the infrastructure are released independently

Code moves only through Git. No push, pull request or schedule starts a workflow: every scan, build, plan, apply and deployment is a run a person starts, for one commit and one environment. A change that is never released costs nothing.


2. Branches

Branch Receives Releases
feature/* Day-to-day work Nothing; merged into dev
dev Merged features, the developer’s own testing Nothing; a release pull request takes it to main
hotfix/* An urgent fix Nothing; a pull request takes it to main
main Releases The only branch whose commits can be released

3. Releasing a commit

Order Run Target What it does
1 infra.yml, action: plan (only when deploy/ changed) nonprod Scan and plan; changes nothing. Read the plan
2 infra.yml, action: apply nonprod Scan, plan and apply; copy state to history/
3 app.yml nonprod Scan, build nonprod, copy its linked images onto themselves in the non-production media bucket, store the build and the images’ checksums as site-nonprod-<sha>, deploy. Then test the site
4 infra.yml, plan, then apply (only when deploy/ changed) prod As 1 and 2, for prod
5 app.yml prod Scan, build prod, compare with site-nonprod-<sha>, copy the images that build links from the non-production media bucket into the production one, deploy

Each run builds or plans for its own environment only, so nonprod and prod are never built in the same run, and a commit you stop releasing after nonprod never costs a prod build. The prod build is compared with the stored nonprod build of the same commit and must differ only in the media address and the Analytics tags, the two values each environment writes into its HTML. Images are copied inside R2 before the deploy, so no page goes live linking an image that is not there yet (ADR-006).


4. Guards

A gate is the Run workflow a person starts. GitHub enforces required reviewers on a private repository only on GitHub Enterprise, so the person starting the run is the approval, and the run records who it was. deploy/scripts/promote-guard.sh checks every run before anything happens:

Check Refuses when
Branch The run was not started on main
Commit The SHA is not a commit on main
Order (infra) The target is prod and the commit’s infrastructure change has not been applied to nonprod
Order (app) The target is prod and the commit has not been deployed to nonprod, or its stored nonprod build has expired

The site and the infrastructure have separate release life cycles (SR-005 SR-F-08): an app run never checks the infrastructure, so when a site change needs new infrastructure, release the infrastructure to that target first. The infrastructure change of a commit is the newest commit in its history that changed deploy/infra/, deploy/modules/ or deploy/scripts/. A successful apply or deployment uploads a marker, promoted-infra-<target>-<change> or promoted-app-<target>-<sha>, kept 90 days; the markers are how the guards know what was released, because a manual run’s own commit is whatever main points at when it starts.


5. State history

State changed by Copied by
infra.yml with action: apply Its own step, after the apply, only if it succeeded
A person in a dev container (account layers, a site’s first setup) state-history-copy.sh on the host, right after the apply
The setup layer’s production workflow Its own step, after a successful apply

Every copy is made by the change itself, right after it succeeded; the state before an apply already has the copy its own change made.


6. Cost and build time

Measure Effect
No push, pull_request or schedule trigger Nothing runs unless a person starts it
One target per run No prod build or plan until the commit is released to prod
plan before apply only when deploy/ changed A site-only release runs no OpenTofu
Caches: npm, Astro content, Trivy database, OpenTofu providers Shorter builds and scans
Images in R2, never in the build Small artifacts; a build fails if dist/images exists

Images stay on the media bucket’s own assets.<domain> address, served by R2 directly, so the site adds no Worker requests.