Field Notes: Releasing Without Regrets
Practical advice collected from release pipelines that went wrong, grouped by the mistake it prevents. Each note is short on purpose; the linked lessons have the details.
Never release from a laptop
A laptop release depends on that laptop's state: uncommitted edits, untracked files, a local branch that isn't pushed, a different compiler, a token in the shell history. The session shows the most common leak, an untracked file ending up in a release archive made with tar, and the two guards against it:
mkdir app && cd app && git init -q
echo 'echo "app 1.0.0"' > app.sh && git add app.sh && git commit -q -m "feat: app"
git tag -a v1.0.0 -m "v1.0.0"
echo "API_KEY=sk-live-123" > .env.local # never committed
echo 'echo "debug build"' >> app.sh # an uncommitted edit
echo "--- tar of the working directory"
tar -czf ../laptop.tar.gz --exclude=.git . && tar -tzf ../laptop.tar.gz | sort
tar -xzOf ../laptop.tar.gz ./app.sh
echo "--- guard 1: refuse to release from a dirty tree"
if [ -n "$(git status --porcelain)" ]; then git status --short; echo "refusing to release: working tree not clean"; fi
echo "--- guard 2: build from the tag, not the directory"
git archive --prefix=app-1.0.0/ -o ci.tar.gz v1.0.0 && tar -tzf ci.tar.gz
tar -xzOf ci.tar.gz app-1.0.0/app.sh--- tar of the working directory
./
./.env.local
./app.sh
echo "app 1.0.0"
echo "debug build"
--- guard 1: refuse to release from a dirty tree
M app.sh
?? .env.local
refusing to release: working tree not clean
--- guard 2: build from the tag, not the directory
app-1.0.0/
app-1.0.0/app.sh
echo "app 1.0.0"
In CI, both problems disappear by construction: a fresh checkout of the tag has no local files and no edits. Practical rules:
- The release credentials live only in CI. If nobody has an npm/PyPI/signing token on their machine, nobody can release from it, by accident or under pressure.
- "Emergency" releases use the same pipeline. If the pipeline is too slow for emergencies, make it faster; a manual side door will be used, and it will skip the checks.
- Make the pipeline runnable locally as a dry run (
semantic-release --dry-run,goreleaser release --snapshot, your own scripts) so nobody needs a laptop release to test it.
Tags are immutable
- Turn on tag protection (GitHub rulesets for
v*: no update, no deletion; GitLab protected tags) and immutable releases on day one. See Annotated vs Lightweight Tags. - A wrong release is fixed by the next version. A tag that never got artifacts (failed pipeline) can be left as is and the next patch released; deleting it confuses tools that already saw it.
- Go modules, the Go checksum database, package registries and every mirror remember what a version contained. "Just re-tag it" breaks them for everyone.
Reproducible artifacts
- Build from the tag in a clean environment, with pinned tool versions (a pinned runner image or container, a lockfile for build tools,
rust-toolchain.toml,.nvmrc,go.mod'stoolchain). - Set
SOURCE_DATE_EPOCHfrom the commit time and normalise archives (sorted names, fixed owner and time,gzip -n); Artifact Naming & Checksums has the flags. - Test reproducibility in CI: build twice (or on two runners) and compare checksums. A difference you find today is a debugging session; one an auditor finds next year is a credibility problem. Reproducible Builds covers compiler-level sources of drift.
A changelog for humans
- Generate the draft, then read it. Remove noise, add one line of highlights, and write upgrade steps for every breaking change (Changelogs for Humans).
- Commit subjects become changelog lines: "fix: crash when the config file is empty" beats "fix: handle edge case". Review PR titles with that in mind.
- Say what users must do: "Run
tad migrateafter upgrading" is the most valuable sentence in a release note. - Keep one changelog per released unit: per package in a monorepo, one for the app.
Versioning libraries vs applications
| Library / SDK / CLI used in scripts | Application / service / game | |
|---|---|---|
| who reads the version | other programs (version ranges, lockfiles) | people (support, users, stores) |
| scheme | SemVer, strictly | SemVer or CalVer (Calendar Versioning) |
| breaking change means | any API, CLI flag, output format or minimum-runtime change | data or save-format incompatibility, removed features |
| release cadence | when something is ready | often a train (Release Trains & Checklists) |
| supported versions | several majors (backports, LTS) | usually latest only (plus store review lag) |
| 0.x | fine while the API is unstable, but go 1.0 once people depend on it | rarely meaningful |
Two specific traps:
- A library's dependencies are part of its API when they appear in its interface. Bumping such a dependency's major version is a major version of the library.
- Apps with plugins or mods are libraries too. A game's modding API or a desktop app's plugin interface deserves its own SemVer version, separate from the marketing version.
Small habits with big payoffs
- Put the version in the binary (
--versionprints version, commit and build date fromSOURCE_DATE_EPOCH) and in every log's first line. Support starts there (git describe & Version Strings). - Keep previous artifacts and image digests for at least as long as you support the version; you can only roll back to something you still have (Rollbacks & Roll-forward).
- Release often. A release with 3 changes is easy to verify and easy to roll back; a release with 300 is neither.
- Pin CI actions by SHA and let a bot update them (Permissions, OIDC & Pinning by SHA).
- After every release, ask: "what did a human do by hand this time?" and automate the answer.
Test yourself
What is the simplest way to make laptop releases impossible?
- Ask people not to
- Keep the publishing credentials only in CI
- Use lightweight tags
- Disable git push
A library bumps a dependency from 2.x to 3.x, and that dependency's types appear in the library's public API. What version bump does the library need?
- Patch
- Minor
- Major
- None
How do you check that a release build is reproducible?
- Trust the build system
- Build twice (or on two machines) from the tag and compare checksums
- Sign the artifact
- Use CalVer