TExcelTAD
Home › Release Engineering & CI/CD › Anatomy of a Release Pipeline

Anatomy of a Release Pipeline

Every release pipeline, from a one-file CLI to a game on three stores, goes through the same stages. Tools differ; the stages don't. Knowing them lets you read any project's CI and see what is missing.

The stages

# Stage What happens Fails when
1 Gate the input lint commit messages, run tests, check that the branch is releasable a commit message breaks the convention, a test fails
2 Decide the version from the commits since the last tag (semantic-release, git-cliff --bump) or from explicit intent files (changesets) nothing releasable has happened
3 Write the notes changelog section and release notes, generated then (optionally) edited —
4 Tag an annotated tag on the exact commit, pushed to the remote the tag already exists (tags are immutable)
5 Build artifacts compile/package from the tag, usually as a matrix (OS × architecture) a platform build breaks
6 Verify artifacts checksums, smoke tests, signatures, SBOM a binary doesn't start, a checksum is wrong
7 Publish GitHub Release, package registry, container registry, store upload credentials or permissions are missing
8 Announce and watch notify, monitor error rates, be ready to roll back the release is bad: roll back or roll forward

Two ordering rules matter more than any tool choice:

  • Tag before you build, build from the tag. Then every artifact can be traced back to one commit. Tagging after building invites "it built from a slightly different commit".
  • Publish last, and all at once. Upload everything to a draft or a staging location, verify, then flip it to public. A half-published release (the Linux binary is up, the Windows one failed) is worse than none.

Where each stage lives

Stage Local tool (this course) CI equivalent
Gate commitlint, test runner a pull_request workflow that must pass before merge
Version + notes semantic-release, git-cliff, changesets the same tools, run in a release job on main
Tag git tag -a, or the release tool the release tool pushes the tag with a CI token
Build make, cmake, cargo, npm pack… a matrix job triggered by the tag
Verify sha256sum -c, smoke test script a job that needs the build jobs
Publish gh release create (needs a token) a job with contents: write permission, in a protected environment

A runnable model: gates and stages

A pipeline is a list of stages where each stage either passes or stops everything after it. This model runs three candidate releases through the same gates and shows where each one stops:

python · try it yourself
import re

CONVENTIONAL = re.compile(r"^(feat|fix|perf|refactor|docs|test|build|ci|chore)(\([\w-]+\))?!?: .+")

def gate_commits(c):
    bad = [m for m in c["commits"] if not CONVENTIONAL.match(m)]
    return (not bad, f"bad commit message: {bad[0]!r}" if bad else "commits ok")

def gate_tests(c):
    return (c["tests_failed"] == 0, f"{c['tests_failed']} test(s) failed" if c["tests_failed"] else "tests ok")

def decide_version(c):
    kinds = [m.split(":")[0] for m in c["commits"]]
    if any(k.endswith("!") for k in kinds):
        bump = "major"
    elif any(k.startswith("feat") for k in kinds):
        bump = "minor"
    elif any(k.startswith(("fix", "perf")) for k in kinds):
        bump = "patch"
    else:
        return (False, "nothing to release")
    major, minor, patch = map(int, c["last"].split("."))
    nxt = {"major": f"{major + 1}.0.0", "minor": f"{major}.{minor + 1}.0", "patch": f"{major}.{minor}.{patch + 1}"}[bump]
    c["next"] = nxt
    return (True, f"{bump} bump: {c['last']} -> {nxt}")

def build(c):
    broken = [p for p in c["platforms"] if p in c.get("broken", [])]
    return (not broken, f"build failed on {broken[0]}" if broken else f"built {len(c['platforms'])} artifacts")

STAGES = [("gate commits", gate_commits), ("gate tests", gate_tests),
          ("version", decide_version), ("build", build)]

candidates = [
    {"name": "A", "last": "1.4.2", "tests_failed": 0, "platforms": ["linux-x64", "windows-x64"],
     "commits": ["fix(io): close files on error", "feat(cli): add --dry-run"]},
    {"name": "B", "last": "1.4.2", "tests_failed": 0, "platforms": ["linux-x64"],
     "commits": ["docs: typo", "chore: bump CI image"]},
    {"name": "C", "last": "1.4.2", "tests_failed": 0, "platforms": ["linux-x64", "macos-arm64"],
     "broken": ["macos-arm64"], "commits": ["feat!: drop the v1 config format"]},
    {"name": "D", "last": "1.4.2", "tests_failed": 2, "platforms": ["linux-x64"],
     "commits": ["Fixed stuff"]},
]

for c in candidates:
    print(f"candidate {c['name']}:")
    for label, stage in STAGES:
        ok, msg = stage(c)
        print(f"  {'PASS' if ok else 'STOP'} {label:<12} {msg}")
        if not ok:
            break
    else:
        print(f"  -> publish v{c['next']}")
candidate A:
  PASS gate commits commits ok
  PASS gate tests   tests ok
  PASS version      minor bump: 1.4.2 -> 1.5.0
  PASS build        built 2 artifacts
  -> publish v1.5.0
candidate B:
  PASS gate commits commits ok
  PASS gate tests   tests ok
  STOP version      nothing to release
candidate C:
  PASS gate commits commits ok
  PASS gate tests   tests ok
  PASS version      major bump: 1.4.2 -> 2.0.0
  STOP build        build failed on macos-arm64
candidate D:
  STOP gate commits bad commit message: 'Fixed stuff'

Candidate D shows why the commit gate runs first: the message "Fixed stuff" can't be turned into a version bump at all, so there's no point running anything else. Candidate C shows why publishing waits for every platform: the version and notes were fine, but one build broke, so nothing goes out.

What "done" looks like

A finished release leaves these traces, and a release engineer checks them, not the CI's green tick:

  • an annotated tag vX.Y.Z on the remote, pointing at a commit on the release branch;
  • a changelog entry and release notes that a user can act on;
  • every artifact, named with the version and platform, plus a checksum file (and a signature);
  • a pipeline run that produced all of the above, linked from the release;
  • nothing done by hand that the next person would have to remember.

Test yourself

Why should artifacts be built from the tag rather than tagged after building?

  1. Tags make builds faster
  2. So every artifact traces back to exactly one tagged commit
  3. CI can't build branches
  4. Git requires it

Two of three platform builds succeed. What should the pipeline do?

  1. Publish the two that worked and fix the third later
  2. Publish nothing; fix and re-run (or roll forward to a new patch version)
  3. Delete the tag and recreate it on another commit
  4. Publish all three with the old binary for the broken one

In the model, why does candidate B not get published?

  1. Its tests failed
  2. Its commits are only docs and chore, so there is nothing to release
  3. Its commit messages are invalid
  4. Its build broke