semantic-release: Next Version & Notes
semantic-release takes the human out of the release decision entirely. On every push to a release branch it looks at the commits since the last release tag, decides the version from their Conventional Commit types, writes the notes, creates the tag and publishes, with no version number ever typed by a person. The sessions use semantic-release 25.0.9 on Node.js 24.
How it decides
- Find the last release: the highest version tag (matching
tagFormat, defaultv${version}) reachable from the current branch. - Collect commits since that tag.
- Analyse each commit with the commit analyzer:
fix/perf→ patch,feat→ minor, breaking → major, anything else → no release. - Next version = last version + the highest bump. No release-worthy commit → nothing happens (and that's a success).
- Generate notes, create the tag, publish, through plugins (next lesson).
It is meant to run in CI, on the release branch, after tests pass. Outside CI it refuses to publish unless you pass --no-ci; --dry-run runs every step that doesn't change anything and prints the notes it would publish.
Configuration
The configuration lives in .releaserc.json (or .releaserc, release.config.js, or a release key in package.json):
{
"branches": ["main"],
"tagFormat": "v${version}",
"repositoryUrl": "file:///home/learner/remote.git",
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/release-notes-generator", { "linkCompare": false, "linkReferences": false }],
["@semantic-release/npm", { "npmPublish": false }]
]
}branches: which branches release, and how (channels and pre-releases: Pre-release Branches & Channels).repositoryUrl: normally read frompackage.jsonor the Git remote. Here the "remote" is a bare repository on disk.linkCompare/linkReferences: the notes would otherwise contain links to commits and compare views on the hosting service; with a local file URL they would be broken, so they're off here.@semantic-release/npmwithnpmPublish: false: writes the version intopackage.jsonbut doesn't publish to a registry. Projects that aren't npm packages leave this plugin out entirely.
A dry run
The repository has a release v1.0.0 and two new commits. The dry run reports what a real run would do:
git init -q --bare remote.git
git clone -q remote.git app 2>/dev/null && cd app
cat > package.json <<'JSON'
{ "name": "app", "version": "0.0.0-development", "private": true }
JSON
cat > .releaserc.json <<'JSON'
{
"branches": ["main"],
"repositoryUrl": "file:///home/learner/remote.git",
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/release-notes-generator", { "linkCompare": false, "linkReferences": false }],
["@semantic-release/npm", { "npmPublish": false }]
]
}
JSON
git add -A && git commit -q -m "feat: initial app"
git tag -a v1.0.0 -m "v1.0.0"
git commit -q --allow-empty -m "fix: handle empty input"
git commit -q --allow-empty -m "feat(cli): add --json flag"
git push -q origin main v1.0.0
semantic-release --no-ci --dry-run
echo "exit code: $?"
git tag[9:45:21 PM] [semantic-release] › ℹ Running semantic-release version 25.0.9
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ⚠ Run automated release from branch main on repository file:///home/learner/remote.git in dry-run mode
[9:45:22 PM] [semantic-release] › ✔ Allowed to push to the Git repository
[9:45:22 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
[9:45:22 PM] [semantic-release] › ℹ Found git tag v1.0.0 associated with version 1.0.0 on branch main
[9:45:22 PM] [semantic-release] › ℹ Found 2 commits since last release
[9:45:22 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[9:45:22 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: feat(cli): add --json flag
[9:45:22 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is minor
[9:45:22 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: fix: handle empty input
[9:45:22 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is patch
[9:45:22 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: minor release
[9:45:22 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[9:45:22 PM] [semantic-release] › ℹ The next release version is 1.1.0
[9:45:22 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:45:22 PM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:45:22 PM] [semantic-release] › ⚠ Skip step "prepare" of plugin "@semantic-release/npm" in dry-run mode
[9:45:22 PM] [semantic-release] › ⚠ Skip v1.1.0 tag creation in dry-run mode
[9:45:22 PM] [semantic-release] › ⚠ Skip step "publish" of plugin "@semantic-release/npm" in dry-run mode
[9:45:22 PM] [semantic-release] › ✔ Published release 1.1.0 on default channel
[9:45:22 PM] [semantic-release] › ℹ Release note for version 1.1.0:
# 1.1.0 (2026-10-23)
### Bug Fixes
* handle empty input de453fe
### Features
* **cli:** add --json flag c825f44
exit code: 0
v1.0.0
Read the log as a checklist:
- "Allowed to push to the Git repository": semantic-release checks write access before doing anything (it does
git push --dry-run). In CI this is where a missing token fails early. - "Found git tag v1.0.0 … Found 2 commits since last release": the last release and the range. With a shallow clone this step finds nothing; CI must fetch full history and tags.
- Analysis: each commit's release type, then the highest: minor →
1.1.0. - Skip … in dry-run mode: the steps that would change something (
prepare, tag creation,publish). - Release note: the notes, grouped by type. The date in the heading is today's date.
git tagstill lists onlyv1.0.0: nothing was created.
The plugin log lines are prefixed with the wall-clock time ([9:41:07 PM]), which changes on every run; it is the only part of the log the course's checker ignores.
No release is a valid outcome
When only docs, chore or ci commits landed, semantic-release exits successfully without a release. That is what makes it safe to run on every push to main:
git init -q --bare remote.git
git clone -q remote.git app 2>/dev/null && cd app
cat > .releaserc.json <<'JSON'
{ "branches": ["main"], "repositoryUrl": "file:///home/learner/remote.git",
"plugins": ["@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator"] }
JSON
git add -A && git commit -q -m "feat: initial app" && git tag -a v1.0.0 -m "v1.0.0"
git commit -q --allow-empty -m "docs: explain configuration"
git commit -q --allow-empty -m "ci: cache dependencies"
git push -q origin main v1.0.0
semantic-release --no-ci --dry-run 2>&1 | sed -E 's/^\[[^]]+\] \[semantic-release\] //' | tail -6[@semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
[@semantic-release/commit-analyzer] › ℹ Analyzing commit: docs: explain configuration
[@semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
[@semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: no release
› ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
› ℹ There are no relevant changes, so no new version is released.
A pitfall: feat! and the default preset
semantic-release's analyzer uses the angular preset by default, which predates the ! syntax. A commit marked breaking only with ! is not even recognised as a feature:
git init -q --bare remote.git
git clone -q remote.git app 2>/dev/null && cd app
cat > .releaserc.json <<'JSON'
{ "branches": ["main"], "repositoryUrl": "file:///home/learner/remote.git",
"plugins": ["@semantic-release/commit-analyzer"] }
JSON
git add -A && git commit -q -m "feat: initial app" && git tag -a v1.0.0 -m "v1.0.0"
git commit -q --allow-empty -m "feat(api)!: drop the v1 endpoints"
git push -q origin main v1.0.0
short() { sed -E 's/^\[[^]]+\] \[semantic-release\] (\[[^]]+\] )?› . +//'; }
echo "--- angular preset (default)"
semantic-release --no-ci --dry-run 2>&1 | short | grep -E 'commit|release version|relevant'
cat > .releaserc.json <<'JSON'
{ "branches": ["main"], "repositoryUrl": "file:///home/learner/remote.git",
"plugins": [
["@semantic-release/commit-analyzer", { "preset": "conventionalcommits" }],
["@semantic-release/release-notes-generator",
{ "preset": "conventionalcommits", "linkCompare": false, "linkReferences": false }]
] }
JSON
echo "--- conventionalcommits preset (analyzer and notes)"
semantic-release --no-ci --dry-run > run.log 2>&1
short < run.log | grep -E 'commit|release version|relevant'
sed -n '/Release note for/,$p' run.log | short--- angular preset (default)
Running semantic-release version 25.0.9
Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
Found 1 commits since last release
Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
Analyzing commit: feat(api)!: drop the v1 endpoints
The commit should not trigger a release
Analysis of 1 commits complete: no release
Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
There are no relevant changes, so no new version is released.
--- conventionalcommits preset (analyzer and notes)
Running semantic-release version 25.0.9
Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
Found 1 commits since last release
Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
Analyzing commit: feat(api)!: drop the v1 endpoints
The release type for the commit is major
Analysis of 1 commits complete: major release
Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
The next release version is 2.0.0
Release note for version 2.0.0:
## 2.0.0 (2026-10-24)
### ⚠ BREAKING CHANGES
* **api:** drop the v1 endpoints
### Features
* **api:** drop the v1 endpoints bbc4292
Two fixes, use both: give the analyzer and the notes generator "preset": "conventionalcommits" (the analyzer then understands !, and the notes get a ⚠ BREAKING CHANGES section), and keep the habit of writing a BREAKING CHANGE: footer, which every preset recognises. With ! alone, the breaking-changes entry can only repeat the subject; a footer puts the actual upgrade instructions there.
Field note: pin the preset to the writer. Preset packages are versioned separately from semantic-release, and each major targets one major of conventional-changelog-writer, the template engine inside the notes generator. semantic-release 25.0.9 bundles writer 8, which renders conventional-changelog-conventionalcommits 9.x; preset 10.x needs writer 9 and fails at generateNotes with Missing helper: "… requires conventional-changelog-writer@9 or newer", while the analyzer (which only parses) keeps working, so a check that only looks at the computed version stays green. This course's image pins preset 9.3.1 for that reason. Pin the preset in your lockfile next to semantic-release, upgrade them together, and run a full dry run (it generates the notes) after every upgrade.
Test yourself
What does semantic-release --dry-run skip?
- Commit analysis
- Everything that changes state: prepare steps, tag creation and publishing
- Generating notes
- Checking push access
Only docs: and ci: commits landed since v1.0.0. What does semantic-release do?
- Releases 1.0.1
- Fails the pipeline
- Exits successfully without a release
- Releases 1.1.0
With the default analyzer preset, how should a breaking change be marked to be detected reliably?
- With
!only - With a
BREAKING CHANGE:footer (or switch the analyzer to the conventionalcommits preset) - With an uppercase type
- With a
major:type
After upgrading only conventional-changelog-conventionalcommits, commit analysis still works but generateNotes fails with Missing helper. Why?
- The commit messages became invalid
- The new preset targets a newer
conventional-changelog-writerthan the notes generator bundles - semantic-release needs
--no-ci - The tag format changed