How do you automate semantic versioning and changelog generation using Git tags?
Semantic Versioning (SemVer) follows the format:
MAJOR.MINOR.PATCH
Example: v2.3.1
It’s based on changes — breaking changes bump MAJOR, new features bump
MINOR, and bug fixes bump PATCH.
Automation tools:
- semantic-release (Node.js)
- GitVersion (for .NET)
- release-please (Google’s tool for GitHub Actions)
Example using semantic-release:
Follow:
npm install semantic-release @semantic-release/git
@semantic-release/github -D
Create a .releaserc.json:
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/github",
"@semantic-release/git"
What it does:
- Reads commit messages (feat:, fix:, breaking:)
- Calculates next version automatically
- Creates a Git tag (e.g., v1.2.0)
- Updates CHANGELOG.md
- Publishes release notes to GitHub
Example output:
chore(release): 1.3.0
- feat: add dark mode toggle
- fix: resolve login error