Day 58beginnerMar 30, 2026

Automate Version Bumps in Your CI/CD Pipeline

Automated semantic versioning turns your commit messages into release versions — no manual version bumps needed.

cicdversioningautomation
Share:

What

Semantic versioning (MAJOR.MINOR.PATCH) combined with conventional commits lets your CI pipeline automatically determine version bumps. Tools like semantic-release read commit messages to decide the next version: fix: bumps PATCH, feat: bumps MINOR, and BREAKING CHANGE: bumps MAJOR. No more debating version numbers in PRs.

Why It Matters

Manual versioning is error-prone and inconsistent. Developers forget to bump versions, argue about whether a change is a patch or minor, and sometimes skip versions entirely. Automated semantic versioning removes the guesswork — your commit messages become the single source of truth for release versions.

Example

# Conventional commit prefixes:
# fix: login button not responding    -> PATCH (1.0.0 -> 1.0.1)
# feat: add dark mode toggle          -> MINOR (1.0.0 -> 1.1.0)
# feat!: redesign auth API             -> MAJOR (1.0.0 -> 2.0.0)
# (or add BREAKING CHANGE: in footer)

# package.json — semantic-release config
# "release": {
#   "branches": ["main"]
# }

# .github/workflows/release.yml
name: Release
on:
  push:
    branches: [main]

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write    # Create tags and releases
      issues: write      # Comment on issues
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full history for semantic-release
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - name: Semantic Release
        run: npx semantic-release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
yaml

Common Mistake

Not following the conventional commit format consistently. One malformed commit like 'fixed the bug' instead of 'fix: resolve login timeout' breaks the automation because semantic-release can't determine the version bump type.

Quick Fix

Use commitlint with husky to enforce conventional commit formats locally before they hit CI. Install with: npm install -D @commitlint/cli @commitlint/config-conventional husky, and add a commit-msg hook that validates every commit message.

Key Takeaways

  • 1fix: commits bump PATCH (1.0.0 -> 1.0.1)
  • 2feat: commits bump MINOR (1.0.0 -> 1.1.0)
  • 3BREAKING CHANGE: bumps MAJOR (1.0.0 -> 2.0.0)
  • 4semantic-release reads commits and creates releases automatically
  • 5Use commitlint + husky to enforce commit format locally

Was this tip helpful?

Help us improve the DevOpsPath daily collection

Share: