The version number should not be a decision a human makes on a Friday afternoon. If someone on your team is still hand-editing a version field, tagging a release, and writing a changelog from memory, you have a manual process sitting on the most audited part of your delivery pipeline.
Conventional Commits is the machine-readable contract that removes that decision. A commit message that starts with feat:, fix:, or carries a BREAKING CHANGE: footer is not just documentation for the next developer. It is structured input that a tool can parse to compute the next semantic version, write the changelog, cut the tag, and publish the artefact, without a person choosing the number. This post wires that up two ways: semantic-release for a single package, and Changesets for a monorepo where one commit does not map cleanly to one release.
What Conventional Commits actually buys you
The specification is small. A commit subject is type(scope): description. The types that drive versioning are the ones that matter: fix: maps to a patch bump, feat: maps to a minor bump, and any commit with BREAKING CHANGE: in the footer (or a ! after the type) maps to a major bump. Everything else, docs:, chore:, refactor:, test:, is release-neutral by default.
Free · 4 minutes
Is your engineering team shipping safely, or quietly accumulating risk?
Fourteen questions on how work gets from idea to production — cadence, testing, rollback, and the key-person risk in your delivery. Banded finding on screen, full sheet by email.
The payoff is not tidier history for its own sake. It is that the semantic version stops being an opinion. The commit history becomes the single source of truth for what changed and how significant it was, and the release tooling derives everything else from it. For a regulated firm that has to evidence what shipped and when, a changelog generated deterministically from signed commits is a far stronger artefact than one typed up after the fact.
Enforce the format at commit time, not in review
A convention that is only enforced by good intentions is not enforced. The cheapest place to reject a malformed message is the moment it is written, in a commit-msg Git hook, using commitlint. Do this with husky so the hook is versioned in the repository rather than living only on one developer’s machine.
# install the tooling
npm install --save-dev @commitlint/cli @commitlint/config-conventional husky
# commitlint.config.js extends the conventional ruleset
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
# initialise husky (v9+) and add the commit-msg hook
npx husky init
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg
Now a commit reading fixed the thing is rejected locally with a clear message; fix: reject expired session tokens passes. The same commitlint check belongs in CI as a backstop for anyone who bypasses hooks with --no-verify, and for the merge commit itself if you squash-merge. The client-side hook is convenience; the CI check is the control.
Let CI compute the version: semantic-release
semantic-release runs on a merge to your release branch, reads the commits since the last tag, works out the bump, updates the changelog, creates the Git tag and GitHub release, and publishes to npm. No one edits a version by hand. The workflow permissions are where most first attempts fail, so set them explicitly on the job.
name: Release
on:
push:
branches: [main]
permissions:
contents: read # least privilege at the workflow level
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # create the tag and GitHub release
issues: write # comment on released issues
pull-requests: write # comment on released pull requests
id-token: write # OIDC for npm provenance / trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # semantic-release needs the full history
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm clean-install
- run: npm audit signatures
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Three details earn their place. fetch-depth: 0 gives the tool the full tag history it needs to find the last release; a shallow clone silently breaks version calculation. The elevated id-token: write permission enables npm provenance and OIDC-based trusted publishing, so you can stop pasting long-lived registry tokens into secrets, the same keyless pattern worth applying to deployment credentials more broadly. And the built-in GITHUB_TOKEN is enough for the tagging and release steps; you only add NPM_TOKEN if you are not using trusted publishing.
Monorepos: why Changesets, not one big bump
semantic-release assumes one repository is one release. In a monorepo publishing several packages, that assumption breaks: a single commit can touch two packages that should version independently, and commit types alone cannot express which packages a change affects. Changesets solves this by decoupling the intent to release from the commit. A developer runs npx changeset, selects the affected packages and the bump for each, and writes a short summary; that intent is committed as a Markdown file under .changeset/.
CI then uses the Changesets action. Instead of publishing on every merge, it opens and maintains a Version Packages pull request that aggregates the pending changesets, applies the bumps, and updates each package’s changelog. Merging that PR is the deliberate, reviewable release decision, after which the same action publishes.
# in your release job, after checkout + install
- uses: changesets/action@v1
with:
version: npm run version # applies pending changesets
publish: npm run release # e.g. changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
The trade-off is honest: semantic-release is fully automatic and best for a single package with disciplined commits; Changesets keeps a human gate on the release itself and handles independent versioning across packages. Pick the one whose failure mode you can live with.
The pre-1.0 trap, and the permission you will get wrong
Two things catch people. First, the pre-1.0 caveat. Under semver, 0.x versions carry no stability promise, and a breaking change on a 0.x line is expected to bump the minor, not the major. semantic-release does not do this for you by default: it starts at 1.0.0 on your first release and treats a breaking change as a major bump thereafter. If you genuinely want to stay in 0.x, you have to configure for it deliberately; Changesets handles the pre-1.0 and prerelease cases more explicitly. Decide the versioning contract before the first tag goes out, because renumbering published packages later is painful.
Second, permissions. The default GITHUB_TOKEN in a workflow triggered by a fork’s pull request is read-only, and organisation settings can restrict it further. A release job that cannot write contents fails at the tagging step with an opaque 403. Set the job-level permissions block as shown, confirm the repository’s Actions settings allow write access to the token, and keep the release logic itself in a reusable workflow so every repository inherits the same audited configuration rather than a copy that drifts. While you are in the pipeline, the same discipline that makes releases reproducible also makes them fast, which is where dependency caching that actually hits pays off.
Get this right and the release stops being an event. Merging a feat: commit produces the correct version, the changelog, the tag, and the published artefact, with no one deciding the number, which is exactly what you want the auditor to find when they ask how a release is authorised.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.