Skip to content

Releases

A release is a merge request. Like every other change, it is reviewed before it happens: a project’s release is a reviewed change to its version number, and the tag that deploys it follows from the merge. Nobody tags a release by hand.

A tag can’t go through a merge request: it isn’t a change to any file, only a name pointing at a commit. So the decision to release is written into a file the project already keeps, and CI makes the tag from it:

  • "version" in package.json, for a Node project;
  • otherwise the first line of a VERSION file.

Reviewers then see the release as an ordinary diff:

"version": "1.1.31",
"version": "1.1.32",

Approving and merging that is the release. A CHANGELOG.md entry in the same merge request, saying what’s shipping, is good practice but not required.

  1. Open the release merge request: the version bump, from the project’s fork like any change, often in the change’s own merge request (Source code; Shipping a change). Its pipeline runs the full check.
  2. Its owners approve it, and a Maintainer merges it (or sets auto-merge), fast-forward, once the review bot’s statuses pass.
  3. The review bot tags it. Right after the merge, it sees a version with no v<version> tag yet, creates the tag on that commit through the API (as svrbc_bot; GitLab refuses its deploy key a protected tag), and starts the tag’s pipeline itself, as svrbc_bot. A project’s CI skips the pipeline GitLab starts for the new tag (a push pipeline for a tag), so the bot’s is the only one; in one that doesn’t, the bot sees it and starts none. On a merge that didn’t change the version, the tag already exists and it does nothing. A push to master starts no pipeline: the merged commit is the one the merge request built and tested.
  4. The tag’s pipeline deploys. Its deploy job runs only for a v* tag pipeline that svrbc_bot started. The bot sets SVRBC_PREVIOUS_RELEASE to the newest earlier release whose pipeline passed, so a job can run only when its files changed since then (rules: changes: compare_to: refs/tags/$SVRBC_PREVIOUS_RELEASE; ci/release.yml shows how). It’s unset when there’s no such release, and then every job runs.

The version bump can ride in the change’s own merge request, and usually does: “The handbook is a PWA; release 1.2.29” is one commit, the change and its release together. An owner who wants a change live in one step ships it:

Terminal window
svrbc-mr --ship # patch: 1.2.29 → 1.2.30
svrbc-mr --ship minor # 1.2.29 → 1.3.0 (or major)
svrbc-mr --ship --no-watch # stop once auto-merge is set
svrbc-mr --watch # pick up watching again, later

svrbc-mr --ship bumps the version on master into the branch’s last commit (adding “; release ” to its subject), opens the merge request as svrbc-mr always does, sets auto-merge, and watches it through each step above: approved, merged, tagged, and the tag’s pipeline passing. Then it reads the site itself: it exits 0 only once the site’s /_/version.json names the release, which the deploy writes last, so a CDN still serving the old pages or a deploy that quietly did nothing isn’t taken for a release. (It finds the site from the project’s production environment; with none, or a site that doesn’t serve the file yet, the pipeline passing is enough.) Everything between setting auto-merge and the deploy already happens on its own; --ship only saves the typing, and says when it’s done.

It finishes on its own only when nobody else has to act:

  • The author owns every path it changes. Then not marking it a draft is their approval (The review bot). When someone else owns one, it says whose approval it’s waiting for and exits 3; run svrbc-mr --watch again once they have.
  • The author is a Maintainer, which setting auto-merge takes.

It exits 1, with a link, if a pipeline fails or the review bot takes it out of the auto-merge queue, and 4 if it’s still going after --timeout minutes (60 by default).

Two branches shipped from the same master bump to the same version. Once one merges, rebasing the other drops its bump without a conflict, since both made the same change, so it would merge and release nothing. So:

  • The review bot holds it: review-bot/approved stays pending, its description starting “held”, while the version its last commit’s subject names (; release <version>, or a commit of just Release <version>) is one master already has. A held merge request can’t merge, and doesn’t take its turn in the auto-merge queue.
  • svrbc-mr --ship bumps it again when it sees the hold while watching: it rebases onto master, bumps to the next version, replaces the subject’s ; release <version>, builds and pushes, and sets auto-merge again. svrbc-mr --watch alone exits 3 and says so instead: run svrbc-mr --ship on the branch.
  • If one merges anyway (the bot hadn't judged the rebased commit yet), watching exits 1 rather than 0, saying nothing deployed: ship a branch of just the bump from master.

GitLab’s free tier can protect tags only by role: v* can be limited to maintainers, but not to svrbc_bot alone. A maintainer could still push a tag by hand. So every deploy job has the rule from .svrbc-release, which runs it only when the tag’s pipeline was started by svrbc_bot. A tag pushed by a person deploys nothing; the only way to production is a merged version bump. The bot creates its tags through the API as svrbc_bot, a maintainer, with its token’s Repository Tag: Create.

.gitlab-ci.yml
include:
- project: svrbc/developers.svrbc.org
file: ci/release.yml
deploy-production:
# …the project's own deploy steps…
rules:
- !reference [.svrbc-release, rules]

Then:

  • put the current version in package.json (or VERSION), matching the latest tag, so merging it releases nothing;
  • nothing for the tags: the review bot protects v* for maintainers (so for svrbc_bot, which creates them) and makes svrbc_bot a direct member, within a day of seeing ci/release.yml (its daily enrolment; svrbc-review-bot-enroll <project> shows whether it has);
  • add the workflow rule that keeps a push to master from starting a pipeline (Verified commits).

A staging branch deploys on every merge, not from tags: its pipeline on the project (never the fork) deploys to the staging site, whose own deploy role trusts only that protected branch, never the release tags (production’s role trusts only the tags). Only the review bot can push to it, so a merge there is as reviewed as a version bump; nothing it deploys is production. svrbc-audit’s release-gate may warn about it, which the project’s AGENTS.md explains.

Keep data that changes on its own out of the release, and the site publishing only from releases. A site whose numbers change without anyone changing its code (analytics.svrbc.org, whose visitor counts come from PostHog) gets them from a scheduled AWS function that writes the data where the page reads it, beside the site rather than in it: infra/analytics-svrbc-org-data/.

It isn’t republished from a GitLab pipeline schedule, which would put data in the release. (A schedule can be made: GitLab lets anyone allowed to merge into master own one, which is Maintainers, and tofu-drift and the nightly audit run on its schedule.)

Nothing in CI needs a token of svrbc_bot: the review bot tags releases and syncs forks with its deploy key, and starts release pipelines with its own token, which renews itself (review-bot). SVRBC_BOT_TOKEN, the group CI variable that ci/release.yml and ci/fork-sync.yml used, is retired: delete it from the group’s CI/CD variables, and revoke the token, once every project is on this.

svrbc-audit warns about a project whose CI deploys from tags without the release gate, and about tags not protected for maintainers.