Home/Engineer/Git / CI·CD/Semantic Versioning + Conven…
Git / CI·CDIntermediateUbuntuDebianmacOSsemverconventional-commitschangelog

Semantic Versioning + Conventional Commits + Automated CHANGELOG

Explains SemVer rules, the Conventional Commits format, and how to automatically generate version tags and a CHANGELOG with standard-version / release-please.

Contents
  1. Semantic Versioning Rules
  2. Conventional Commits Format
  3. Automated releases with standard-version
  4. Automated releases with GitHub Actions
  5. Example CHANGELOG.md output
  6. [2.5.0] - 2025-05-27
  7. [2.4.2] - 2025-05-20

Semantic Versioning Rules

MAJOR.MINOR.PATCH — e.g. 2.4.1

Change typeNumber to bumpExample
Backward-compatible bug fixPATCH2.4.1 → 2.4.2
Backward-compatible featureMINOR2.4.1 → 2.5.0
Breaking changeMAJOR2.4.1 → 3.0.0
  • Before 1.0.0 is initial development (breaking changes are allowed)
  • Pre-release: 1.0.0-alpha.1, 1.0.0-beta.2
  • Build metadata: 1.0.0+20250527

Conventional Commits Format

CODE
<type>(<scope>): <subject>

[body]

[footer]

Types:

TypeMeaningVersion impact
featNew featureMINOR
fixBug fixPATCH
docsDocumentation only-
styleFormatting (no functional change)-
refactorCode cleanup with no functional change-
perfPerformance improvementPATCH
testAdd or update tests-
choreBuild or config changes-
ciCI config changes-
BREAKING CHANGENot backward compatibleMAJOR
Bash
# example
git commit -m "feat(auth): add OAuth2 login"
git commit -m "fix(api): fix timeout error"
git commit -m "feat!: remove the existing API"
# or in the footer
git commit -m "feat: new authentication method

BREAKING CHANGE: /api/v1/login endpoint removed"

Automated releases with standard-version

Bash
npm install --save-dev standard-version
JSON
// package.json
{
  "scripts": {
    "release": "standard-version",
    "release:minor": "standard-version --release-as minor",
    "release:major": "standard-version --release-as major",
    "release:patch": "standard-version --release-as patch"
  }
}
Bash
# Automatically bump the version, generate CHANGELOG, and create a git tag
npm run release

# Dry run (preview without making changes)
npx standard-version --dry-run

# Push tags
git push --follow-tags

Automated releases with GitHub Actions

YAML
# .github/workflows/release.yml
name: Release

on:
  push:
    branches: [main]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0      # full history required

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Configure Git
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"

      - name: Release
        run: |
          npm ci
          npx standard-version
          git push --follow-tags
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Example CHANGELOG.md output

MARKDOWN
# Changelog

## [2.5.0] - 2025-05-27
### Features
- **auth:** add OAuth2 login (abc1234)

### Bug Fixes
- **api:** fix timeout error (def5678)

## [2.4.2] - 2025-05-20
### Bug Fixes
- **db:** fix connection leak (ghi9012)
#semver#conventional-commits#changelog#git
Editorial note

AI tools may assist drafting. Check the evidence in each guide for whether commands were run and which environment was used. Confirm the current docs for your version before applying instructions, and email us about errors. email us

Topic-related official docs (auto-linked · not per-claim sources)Git documentation ↗

Questions & answers

Ask a question about this guide. We'll review and reply.