Semantic Release¶
This project uses python-semantic-release for automated versioning and releases.
How It Works¶
Conventional Commits¶
Semantic Release analyzes commit messages following the Conventional Commits specification:
Version Bumping¶
Based on commit types:
| Commit Type | Version Bump | Example |
|---|---|---|
feat: |
Minor (0.X.0) | feat: add new command |
fix: |
Patch (0.0.X) | fix: resolve bug in parser |
perf: |
Patch (0.0.X) | perf: improve startup time |
BREAKING CHANGE: |
Major (X.0.0) | feat!: redesign CLI interface |
Workflow¶
Developer commits with conventional format
↓
Push to main branch
↓
Release Workflow
├─ Analyze commits (python-semantic-release)
├─ Determine next version
├─ Build binaries
├─ Create git tag
├─ Update CHANGELOG.md
├─ Create GitHub release
└─ Upload binaries
Commit Message Format¶
Types¶
feat:- New feature (minor version bump)fix:- Bug fix (patch version bump)perf:- Performance improvement (patch version bump)docs:- Documentation changes (patch version bump)style:- Code style changes (patch version bump)refactor:- Code refactoring (patch version bump)test:- Test changes (patch version bump)build:- Build system changes (patch version bump)ci:- CI configuration changes (patch version bump)chore:- Other changes (no version bump)
Examples¶
Feature (minor bump):
git commit -m "feat: add code generation command"
git commit -m "feat(cli): add --verbose flag to all commands"
Bug fix (patch bump):
git commit -m "fix: resolve template rendering issue"
git commit -m "fix(parser): handle empty input correctly"
Breaking change (major bump):
Documentation (patch bump):
No release:
Usage¶
Automatic Release (Recommended)¶
Just push to main with conventional commits:
# Make changes
git add .
git commit -m "feat: add new feature"
git push origin main
# GitHub Actions automatically:
# 1. Analyzes commits
# 2. Determines version (e.g., 1.1.0)
# 3. Builds binaries
# 4. Creates tag v1.1.0
# 5. Updates CHANGELOG.md
# 6. Creates GitHub Release with binaries
Manual Trigger¶
You can manually trigger the release workflow:
- Go to Actions → Release
- Click "Run workflow"
- Select branch (main)
- Click "Run workflow"
Generated Files¶
Semantic Release automatically updates:
CHANGELOG.md- Auto-generated changelog- Git tags - Version tags (e.g.,
v1.2.3) - GitHub Release - With binaries and release notes
CHANGELOG.md¶
Automatically generated with sections:
- Features - New features (
feat:) - Bug Fixes - Bug fixes (
fix:) - Performance Improvements - Performance improvements (
perf:) - Documentation - Documentation changes (
docs:)
Skipping Release¶
To skip release for a commit:
Or use chore: type (doesn't trigger release).
Troubleshooting¶
No release created¶
Check:
- Commits follow conventional format
- Commits are on
mainbranch - Commit types trigger releases (not
chore:) - Workflow has write permissions
Wrong version bump¶
Check:
- Commit type is correct
- Breaking changes use
!orBREAKING CHANGE: - Multiple commits are analyzed together
CHANGELOG not updated¶
Check:
- Workflow completed successfully
- Git push succeeded
- File is committed to repository
Best Practices¶
- Always use conventional commits - Enables automatic versioning
- Write clear commit messages - Subject line: what changed
- Group related changes - One feature = one commit
- Use scopes for clarity -
feat(cli):,fix(parser): - Document breaking changes - Use
!andBREAKING CHANGE:
Examples¶
Feature Release¶
# Commit
git commit -m "feat: add template validation"
git push origin main
# Result
# → Version: 1.1.0
# → Tag: v1.1.0
# → CHANGELOG: Added under "Features"
# → Release: Created with binaries
Bug Fix Release¶
# Commit
git commit -m "fix: resolve parsing error"
git push origin main
# Result
# → Version: 1.0.1
# → Tag: v1.0.1
# → CHANGELOG: Added under "Bug Fixes"
# → Release: Created with binaries
Breaking Change Release¶
# Commit
git commit -m "feat!: redesign command structure
BREAKING CHANGE: Commands now use subcommands"
git push origin main
# Result
# → Version: 2.0.0
# → Tag: v2.0.0
# → CHANGELOG: Added under "BREAKING CHANGES"
# → Release: Created with binaries