How-To2026-09-0510 min read

How to Set Up Semantic Versioning in GitHub

Semantic versioning (semver) gives version numbers meaning. When a version bumps from 2.3.1 to 3.0.0, consumers know there are breaking changes. When it bumps to 2.4.0, they know there are new features. Without a versioning system, version numbers are arbitrary and changelogs are manual. GitHub's release system combined with conventional commits lets you automate the entire flow from commit to tagged release.

Setting up semver properly involves three pieces: a commit convention that encodes change type, a CI workflow that determines the next version based on commits, and a release pipeline that creates the tag, changelog, and GitHub release. This guide walks through implementing all three so your versioning runs on autopilot.

Step-by-step guide

01

Adopt conventional commits as your commit message standard

Conventional commits use a structured format: type(scope): description, where type is feat, fix, chore, docs, refactor, or similar. A feat commit triggers a minor version bump, a fix triggers a patch bump, and adding BREAKING CHANGE in the commit body triggers a major bump. Communicate this convention to your team and add it to your contributing guide. Without structured commits, automated version determination is impossible.

  • Document the commit format in CONTRIBUTING.md with examples
  • List the valid types and what each means for versioning
  • Explain how to flag breaking changes using the BREAKING CHANGE footer
02

Add commitlint to enforce commit message format

Install @commitlint/cli and @commitlint/config-conventional as dev dependencies. Create a commitlint.config.js file that extends the conventional config. Add a commit-msg Git hook using Husky that runs commitlint on every commit. This prevents non-conforming commit messages from entering the repository, which would break the automated version calculation.

03

Configure semantic-release for automated version management

Install semantic-release and its GitHub plugin. Create a .releaserc.json file that configures the release branches (typically main), enables the changelog generation plugin, and sets up the GitHub release plugin. Semantic-release analyzes all commits since the last tag, determines the correct version bump based on conventional commit types, and creates the release automatically.

  • Install semantic-release, @semantic-release/changelog, and @semantic-release/github
  • Configure .releaserc.json with the correct branch and plugin order
  • Add a GITHUB_TOKEN secret to your repository for the release workflow
04

Create a GitHub Actions workflow for releases

Add a workflow file at .github/workflows/release.yml that triggers on push to main. The workflow should checkout the code, install dependencies, and run npx semantic-release. Semantic-release will determine if a release is needed based on the commits since the last tag, bump the version, generate the changelog, create the Git tag, and publish a GitHub release with auto-generated release notes.

05

Set up branch protection to enforce the workflow

Configure branch protection rules on main to require pull requests and status checks before merging. This ensures all commits that reach main go through the PR process with commitlint validation. Direct pushes to main would bypass the commit convention enforcement. Also require that the CI build passes before merge so broken code does not trigger a release.

06

Add version badges and changelog links to your README

Add a shield.io badge to your README that displays the current version from the latest GitHub release. Link the badge to your CHANGELOG.md or GitHub releases page. This gives consumers an instant view of the current version and a click-through to see what changed. For libraries, update the version in package.json as part of the semantic-release pipeline so published packages carry the correct version.

Common mistakes

Not enforcing commit conventions with tooling

Documenting conventional commits without enforcing them leads to inconsistent messages that break automated versioning. If even one commit message is non-conforming, semantic-release may miscategorize the change or skip a needed version bump. Use commitlint with a Git hook to enforce at commit time.

Using manual version bumps alongside automation

If some developers manually edit version numbers while the CI also bumps versions, you get conflicts and duplicated tags. Once you adopt semantic-release, the automation is the single source of truth for version numbers. Remove any manual versioning steps from your process.

Releasing from feature branches

Semantic-release should only run on your release branches (typically main). If it runs on feature branches, you get premature releases and tag pollution. Configure the release branches explicitly in .releaserc.json and ensure the workflow only triggers on those branches.

Forgetting to set up a GITHUB_TOKEN with sufficient permissions

Semantic-release needs permission to create tags, releases, and potentially push commits (for changelog updates). The default GITHUB_TOKEN may not have sufficient permissions. Verify that your workflow token has write access to repository contents and can create releases.

Tips

Use the @semantic-release/exec plugin to run custom scripts during release — useful for updating version references in documentation or Dockerfiles.

Configure pre-release branches (e.g., next or beta) in semantic-release to publish pre-release versions for testing before they reach main.

Add the semantic-release dry-run to your PR checks so contributors can see what version their changes would produce before merging.

Use GitHub's auto-generated release notes feature alongside semantic-release's changelog for a consumer-friendly summary that groups changes by type.

How Vantage helps

Vantage generates dependency-aware tickets that include technical context like versioning implications. When a PRD involves API changes, Vantage flags the need for major version bumps in the generated tickets, ensuring that versioning decisions are part of the planning process rather than an afterthought during code review.

Frequently asked questions

Spend less time on setup, more on decisions

Vantage connects your tools and generates specs grounded in real data. Free to start.

Free to start. No credit card required.

Related reading