How-To Guide

How to Build a Release and Changelog Pipeline

Automate the release and the changelog: derive the version and the notes from the commits, tag and publish, and keep it repeatable.

On this page

  1. Introduction
  2. Derive the version from the commit types
  3. Generate the changelog from the commits
  4. Tag and publish in one flow
  5. Keep the release repeatable and verifiable
  6. Test the version and the changelog
  7. Common pitfalls
  8. Conclusion

Introduction

A release is a version, a changelog, a tag, and a published artifact, and doing them by hand drifts: the version is guessed, the changelog omits a change, the tag does not match the package. A release pipeline derives them from the commit history, so the version follows the changes and the changelog is complete. The commit messages become the input, which is why writing them to a convention matters.

This tutorial covers deriving the version from the commits, generating the changelog from them, tagging and publishing in one flow, and testing the pipeline. The examples use the conventional commits and semantic versioning, and the design applies to any project with a commit history.

Derive the version from the commit types

The commits carry a type, such as fix, feat, or a breaking-change marker, and the type determines the version increment under semantic versioning: a fix is a patch, a feat a minor, a breaking change a major. The pipeline reads the commits since the last tag, finds the highest increment among them, and computes the next version. The version is derived, not decided.

The convention is what makes it derivable: without a type, the pipeline cannot tell a fix from a feature. Adopt the convention, and enforce it in the commit or the pull request, so the history is parseable. The result is a version that reflects the change’s impact, which is what semantic versioning is for: a major change signals the consumers the API broke.

# the commits since the last tag decide the increment
git log v1.2.0..HEAD --oneline
# a "fix:" -> patch, a "feat:" -> minor, a "BREAKING CHANGE" -> major
# the next version is the highest increment among the commits

Generate the changelog from the commits

The changelog is generated from the same commits, grouped into the sections by type: the features, the fixes, and the breaking changes. Each entry is the commit’s subject, and the sections are the release notes. The changelog is derived from the history, so it is complete and consistent with the version.

A conventional-commit tool generates the changelog and the version together, so a release is one command that reads the commits, bumps the version, writes the changelog, tags, and publishes. The tooling keeps the changelog and the version in sync, and the maintainer reviews the generated notes rather than writing them from memory.

## [1.3.0] - 2026-10-22
### Features
- add pagination to the orders endpoint (#42)
### Bug Fixes
- handle an empty cart without error (#44)
### BREAKING CHANGES
- the list response is now paginated; read `items` instead of the array

Tag and publish in one flow

The release flow tags the version, publishes the artifact, and creates the release, in one automated step, so the tag, the published package, and the changelog agree. A manual sequence drifts: the tag from one commit and the package from another, or a tag without the publish. The automation makes them consistent.

The flow should be triggered by the merge, or by a command the maintainer runs on the release branch, and it should be idempotent, so a retry does not create a second tag or a duplicate publish. The publication is the point of no return: the artifact is public, so the pipeline verifies the tests and the build before it, and publishes after.

# one flow: version, changelog, tag, publish, release
node scripts/release.mjs        # reads the commits, bumps the version
git push --follow-tags          # the tag
npm publish                     # the artifact
gh release create v1.3.0 --notes-file CHANGELOG.md   # the release notes

Keep the release repeatable and verifiable

The release should be repeatable: the same commits produce the same version and the same changelog. A pipeline that depends on the current time or the maintainer’s input is not repeatable, and it drifts. The version is derived from the commits and the tags, and the changelog from the same, so the output is a function of the history.

The published artifact should be verifiable: the version it carries matches the tag, and the changelog matches the changes. A release that can be traced from the tag to the artifact to the changelog is one the consumer can trust. The pipeline’s job is to keep those three consistent, and the review is to confirm it.

Test the version and the changelog

Test the version computation with a set of commits and the expected next version: a fix-only set yields a patch, a set with a feature a minor, and a set with a breaking change a major. Test the changelog generation with a set of commits and the expected sections. Test the flow’s idempotency, by running it twice and asserting one tag and one publish. These tests make the pipeline predictable.

# a set of commits -> the expected version
node -e '
const { nextVersion } = require("./release");
assert(nextVersion("1.2.0", ["fix: a"]).version === "1.2.1");          // patch
assert(nextVersion("1.2.0", ["feat: a"]).version === "1.3.0");         // minor
assert(nextVersion("1.2.0", ["feat!: a"]).version === "2.0.0");        // major
'

Common pitfalls

A hand-written version and changelog that drift, a commit history without the types so the version cannot be derived, a tag, a package, and a changelog from different commits, a non-idempotent flow that creates a second tag on a retry, and no test so a change to the convention silently breaks the release are the recurring mistakes. A conventional history, a derived version and changelog, a single automated flow, idempotency, and the tests address them.

Conclusion

A release and changelog pipeline derives the version and the notes from the commit history, so they cannot drift. Derive the version from the commit types, generate the changelog from the same, tag and publish in one idempotent flow, and test the version, the changelog, and the idempotency. Self-check by asserting a fix-only set yields a patch and a breaking set a major, and that a retry does not duplicate the tag. Then a release is repeatable and consistent.

Sources: Conventional Commits, Semantic Versioning, Keep a Changelog.

FAQ

How is the version decided?
From the commit messages' convention: a fix increments the patch, a feature the minor, and a breaking change the major, following semantic versioning. The convention is what makes the version derivable, so the maintainer does not decide it by hand and the components stay compatible.
Why generate the changelog?
A hand-written changelog drifts and omits the changes the maintainer forgot. A generated one is derived from the commit history, so it is complete and consistent with the release. The commit messages become the changelog, which motivates writing them well.

Related Examples