This document describes how to release a new version of trend_classifier.
Before releasing, ensure you have:
- GitHub CLI installed and authenticated (
gh auth status) - PyPI API token configured in GitHub secrets (
PYPI_API_TOKEN) - Clean working directory (
git statusshows no changes) - All tests passing (
make test) - On the
mainbranch
One command handles the entire release process:
make release-patch # 0.3.0 → 0.3.1 (bug fixes)
make release-minor # 0.3.0 → 0.4.0 (new features)
make release-major # 0.3.0 → 1.0.0 (breaking changes)This automatically:
- ✅ Runs tests, linting, and security checks
- ✅ Bumps version in all files
- ✅ Updates CHANGELOG.md with git-cliff
- ✅ Commits changes with conventional commit message
- ✅ Creates git tag (v0.x.x)
- ✅ Pushes to GitHub (main branch + tags)
- ✅ Creates GitHub Release with release notes
- ✅ Triggers PyPI publish via GitHub Actions
The version is maintained in two files (updated automatically by bump-my-version):
| File | Field |
|---|---|
pyproject.toml |
version = "X.X.X" |
src/trend_classifier/__init__.py |
__version__ = "X.X.X" |
| Command | Purpose |
|---|---|
make show-version |
Show current version |
make preview-release-notes |
Preview changelog for current version |
make changelog |
Regenerate full CHANGELOG.md |
make version-patch |
Bump version only (no commit/tag/push) |
make version-minor |
Bump minor version only |
make version-major |
Bump major version only |
If automation fails, follow these steps:
make lint
make type-check
make security
make test-cov# Choose one:
uv run bump-my-version bump patch # 0.3.0 → 0.3.1
uv run bump-my-version bump minor # 0.3.0 → 0.4.0
uv run bump-my-version bump major # 0.3.0 → 1.0.0uv run git-cliff -o CHANGELOG.mdVERSION=$(uv run bump-my-version show current_version)
git add -A
git commit -m "chore(release): bump version to $VERSION"
git tag "v$VERSION"git push origin main --tagsVERSION=$(uv run bump-my-version show current_version)
gh release create "v$VERSION" \
--title "Release $VERSION" \
--generate-notes \
--latestThe GitHub Actions workflow (.github/workflows/release.yml) automatically publishes to PyPI when a v* tag is pushed.
Check status at: https://github.com/izikeros/trend_classifier/actions
Trigger: Push tag matching v*
Steps:
- Checkout code
- Set up Python 3.12
- Install uv
- Build package (
uv build) - Publish to PyPI (trusted publishing)
File: .github/workflows/release.yml
git status
git stash # or commit/discard changesbrew install gh
gh auth loginYou cannot republish the same version. Bump to a new version and try again.
Fix tests before releasing:
make test-covCreate release manually:
gh release create "v0.3.1" --title "Release 0.3.1" --generate-notes- Check GitHub Actions logs
- Verify
PYPI_API_TOKENsecret is set - Manual publish as fallback:
make build
uv run twine upload dist/*This project follows Semantic Versioning:
- MAJOR (1.0.0): Breaking API changes
- MINOR (0.1.0): New features, backward compatible
- PATCH (0.0.1): Bug fixes, backward compatible
The changelog is generated by git-cliff using conventional commits:
feat:→ 🚀 Featuresfix:→ 🐛 Bug Fixesperf:→ ⚡ Performancebreak:→ 💥 Breaking Changes
Configuration: cliff.toml