Semantic Versioning
1 min readMAJOR.MINOR.PATCH explained: pre-release labels, build metadata, the rules, and automating releases with conventional commits.
Table of Contents
Purpose
- Communicating changes to consumers
- Indicating stability / product maturity
- Automating dependency updates
Format
MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]
Version Components
| Component | When to Increment | Example |
|---|---|---|
| MAJOR | Incompatible API changes (breaking) | 1.0.0 → 2.0.0 |
| MINOR | New functionality, backward compatible | 1.0.0 → 1.1.0 |
| PATCH | Backward-compatible bug fixes | 1.0.0 → 1.0.1 |
Pre-release Labels
alpha → beta → RC1 → RC2 → release
1.0.0-alpha.1— Early testing1.0.0-beta.2— Feature complete, testing1.0.0-rc.1— Release candidate, final validation
Build Metadata (Optional)
1.0.0+build.123
1.0.0+sha.abc123
- Does not affect precedence
- Used for CI/CD traceability
Rules
- Public API must be declared (OpenAPI, headers, docs)
- Once released, never modify — re-release with new version
- Pre-release < Release —
1.0.0-alpha < 1.0.0 - Build metadata ignored for precedence
Automation
- Conventional Commits → auto-semver (feat=minor, fix=patch, BREAKING=major)
- Release Please, semantic-release, changesets — automate versioning + changelog
Related
- Version number: why it matters — Version numbers for documents, not just code