Skip to content
All projects

Delivery · 2026

Build Once, Promote Everywhere

Most pipelines rebuild the image on the way to each environment, which quietly means production runs something nobody tested. This builds once into GHCR and promotes that same image forward — merging to main deploys nothing, and shipping is a deliberate human act.

If a pipeline runs docker build again on the way to production, then the thing you tested in staging and the thing customers get are two different builds that you are hoping are identical. Usually they are. The interesting days are the ones where a base image moved, or a dependency was republished under the same version, and now production is running code that never passed a test.

This repo is a working pipeline built around the opposite rule: an image is produced exactly once, and every environment after that receives that image.

The problem it solves

Two habits cause most of the trouble, and they are both about who decides to ship.

The first is rebuilding per environment, which breaks the chain of evidence between “tested” and “deployed”. The second is treating a merge to main as a deployment — which means a routine code review becomes a release decision, and nobody can answer “what is in production?” without reading commit history.

How it works

① merge to main ② draft release nothing deploys ③ publish draft = cut vX.Y.Z ④ build once into GHCR ⑤ staging ⑥ production approval, same image promote
Production is the only arrow that skips the build. That is the entire design.

Walking the path:

  1. Merging to main runs tests and nothing else. No image, no rollout.
  2. A draft release accumulates instead, with the next semantic version worked out from the labels on the pull requests that were merged.
  3. Publishing that draft is the decision to ship. It is a person clicking a button, and it is what cuts the version tag.
  4. The image is built once, from the tag itself rather than from main — by the time a release is published, main may have moved on.
  5. Staging gets it automatically, through a reusable deploy workflow that every environment shares, so there is one rollout path to read instead of six.
  6. Production promotes. It dispatches that same deploy workflow with the image reference that already exists, behind a GitHub Environment with a required reviewer. There is no build step on this arrow at all.

Steps 4 and 6 are the point. Because the build workflow returns the image reference as an output, promotion can pass the exact artefact forward rather than reconstructing a name and hoping it matches.

The design, stated in the repo’s own words

The clearest expression of it is a comment at the top of the workflow:

# Production is deliberately not here. It promotes an image this workflow
# already built and staging already ran, so it dispatches deploy.yml directly
# with no build at all.

The approval is not a conditional somebody can forget — it is the environment itself, so the job simply waits:

    # Production has a required reviewer on its GitHub environment, so the job
    # waits here for approval. Dev and staging have no protection rules.
    environment:
      name: ${{ inputs.environment }}

What the repo is honest about

There is no cluster behind this repository, so the Argo CD sync calls print what they would do rather than doing it, and the deploy job resolves a nonprod/prod runner pool without a self-hosted pool to route to. What is real is everything the design rests on: the reusable workflows, the environment gate holding production until someone approves, and the image reference being handed from build to deploy untouched.

All six workflows are in the repo.