Guide · Open source
How to use semantic-release: setup, commits and automated releases
Updated · written with AI from the project's own documentation and checked against our catalogue data
semantic-release is a tool that runs in a continuous integration (CI) environment after code is merged. It reads your commit messages, works out the next Semantic Versioning number, generates release notes and a changelog, and publishes the package. This guide explains the commit format it expects, where it fits in CI, and the release steps it runs, so you can set it up for a JavaScript package.
Quick start
- 1Check prerequisites. Make sure Node.js, npm and Git are available and that your project already runs in a CI service.
- 2Adopt the commit format. Write commits in the Angular format, using fix, feat, and a BREAKING CHANGE footer where relevant.
- 3Add the release branches. Decide which branches trigger releases, such as master, main, next or beta.
- 4Run semantic-release in CI. Add the semantic-release command as a step that runs after your tests pass on the release branch.
- 5Choose channels if needed. If you want pre-releases or npm dist-tags, follow the matching recipe on semantic-release.org.
- 6Push a commit and check the run. Push or merge a commit, then check the CI log to see which release step ran.
What semantic-release needs before you start
The README lists Node.js, npm and Git as prerequisites. The tool is meant to run inside CI after each build, so you need a CI service already set up for your project.
Install method: package manager. The README's install command shown in the source is a clone of the repository: git clone https://github.com/semantic-release/semantic-release.git. For normal use, follow the project's documentation at semantic-release.org for installation and configuration.
- Node.js
- npm
- Git
- A CI service that runs your build on the release branch
git clone https://github.com/semantic-release/semantic-release.gitWrite commit messages in the Angular format
semantic-release decides the release type from your commit messages. By default it uses the Angular Commit Message Conventions. A fix produces a patch release, a feat produces a minor release, and a commit with a BREAKING CHANGE footer produces a major release.
The BREAKING CHANGE token must be in the footer of the commit. Tools such as commitizen or commitlint can help contributors write valid messages. The format can be changed with the preset or config options of the commit analyzer and release notes generator plugins.
- fix(scope): message gives a Fix Release (patch)
- feat(scope): message gives a Feature Release (minor)
- A commit with BREAKING CHANGE: in the footer gives a Breaking Release (major)
fix(pencil): stop graphite breaking when too much pressure appliedRun semantic-release in CI after each build
semantic-release is meant to run on the CI environment after every successful build on the release branch. Release branches include examples such as master, main, next and beta.
Each new commit pushed to a release branch, or merged from a pull request or another branch, triggers a CI build. That build runs the semantic-release command and makes a release only if there are changes since the last release that affect the package functionality.
- Pushes or merges to a release branch trigger a CI build
- The semantic-release command runs after the tests pass
- No release is made if nothing affects the package functionality
semantic-releaseUnderstand the release steps
When you run semantic-release after the tests, it works through a fixed set of steps. Knowing them helps when a run fails, because the error tells you which step stopped.
- Verify Conditions: checks that everything needed to release is in place
- Get last release: finds the last release commit from Git tags
- Analyze commits: decides the release type from commits since then
- Verify release: checks the release is valid
- Generate notes: writes release notes for the new commits
- Create Git tag: tags the commit with the new version
- Prepare: prepares the release
- Publish: publishes the release
- Notify: announces the release or reports errors
Use distribution channels, pre-releases and maintenance releases
semantic-release can publish to different distribution channels, such as npm dist-tags, based on which branch was merged. It also supports pre-releases and maintenance releases. The README points to recipes for each of these workflows.
- Distribution channels: see the recipe on publishing on distribution channels
- Pre-releases: see the recipe on publishing pre-releases
- Maintenance releases: see the recipe on publishing maintenance releases
Configure plugins and shareable configurations
The tool supports any package manager and language through plugins. Configuration can be kept simple and reused through shareable configurations. The README also notes support for npm package provenance, which adds signed attestations on GitHub Actions.
The source excerpt is truncated before the full requirements and configuration details, so check the project documentation for exact configuration keys and plugin names.
- Plugins: see the plugins page on semantic-release.org
- Shareable configurations: see the shareable configurations page
- npm provenance: supported via signed attestations on GitHub Actions
What people use it for
- Automatically publish a new npm package version after a fix is merged to main
- Publish pre-releases from a beta branch using a separate channel
- Publish maintenance releases for an older version line
- Stop manual version edits and changelog writing for a JavaScript library
Frequently asked questions
Is semantic-release free to use?
The project is licensed under MIT, according to the source. Check the license file in the repository for the full terms.
What do I need to install semantic-release?
The prerequisites listed in the source are Node.js, npm and Git. It is meant to run inside a CI service after each build, so CI setup is also needed.
Does semantic-release work without commit messages?
Not well. Version decisions depend on structured commit messages. By default it uses the Angular Commit Message Conventions.
Can I use semantic-release for languages other than JavaScript?
The README says it supports any package managers and languages via plugins. Check the plugins page for what is available.
How does semantic-release compare to release-please, standard-version or changesets?
The source lists these as comparable projects but does not compare them in detail. Check each project's documentation to decide which fits your workflow.
Why is my semantic-release run not making a release?
According to the source, a release is made only if there are changes since the last release that affect the package functionality. Check your commit messages and the CI log for the Analyze commits step.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
semantic-release suits maintainers of JavaScript packages who already use CI and are willing to write structured commit messages. If you prefer to choose version numbers by hand, or you have no CI setup yet, pick a simpler tool or set up CI first.
Install options & downloads