Release Process
This document describes the automated release process for the oboyu package using GitHub Actions workflows with changelog generation and GitHub Packages support.
Overview
The project uses three GitHub Actions workflows to automate package publishing:
- Test PyPI Publishing (
test-pypi.yml
) - For development testing - Prerelease Publishing (
prerelease.yml
) - For alpha, beta, and release candidate versions with GitHub releases - Stable Release Publishing (
release.yml
) - For production releases with automatic changelog generation
Workflows
Test PyPI Publishing
Triggered by: Pushes to main
or develop
branches
Purpose: Allows testing of the package installation process without affecting the production PyPI repository.
Environment: test-pypi
(requires environment configuration in repository settings)
URL: https://test.pypi.org/p/oboyu
Prerelease Publishing
Triggered by: Tags matching prerelease patterns:
- Alpha:
v0.2.0a1
,v0.2.0a2
, etc. - Beta:
v0.2.0b1
,v0.2.0b2
, etc. - Release Candidate:
v0.2.0rc1
,v0.2.0rc2
, etc.
Purpose:
- Publishes prerelease versions to PyPI for early testing
- Creates GitHub prerelease with changelog
- Publishes to GitHub Packages
Environment: pypi-prerelease
(requires environment configuration in repository settings)
Features:
- Automatic prerelease type detection (Alpha/Beta/RC)
- Changelog generation from conventional commits
- GitHub release creation with appropriate prerelease flag
Installation:
# Install latest prerelease
pip install --pre oboyu
# Install specific prerelease
pip install oboyu==0.2.0a1
Stable Release Publishing
Triggered by: Tags matching stable release pattern: v0.2.0
, v1.0.0
, etc.
Purpose:
- Publishes stable releases to PyPI
- Creates GitHub releases with auto-generated changelog
- Updates CHANGELOG.md file
- Publishes to GitHub Packages
Environment: pypi-release
(requires environment configuration in repository settings)
Features:
- Automatic changelog generation from conventional commits
- Categorized changelog (Features, Bug Fixes, Documentation, etc.)
- CHANGELOG.md auto-update and commit
- Release assets upload (wheels and source distributions)
Installation:
pip install oboyu
# Or from GitHub Packages
pip install oboyu --index-url https://ghcr.io/sonesuke/oboyu
Release Process
Prerequisites
-
GitHub Environment Configuration: Set up the following environments in repository settings:
test-pypi
pypi-prerelease
pypi-release
-
PyPI Trusted Publishing: Configure trusted publishing for each environment to avoid managing API tokens.
-
Conventional Commits: Ensure all commits follow the Conventional Commits specification for proper changelog generation:
feat:
for new featuresfix:
for bug fixesdocs:
for documentation changeschore:
for maintenance tasksrefactor:
for code refactoringtest:
for test additions/changesstyle:
for code style changes
Making a Release
1. Create and Push Tag
The package version is automatically determined from Git tags using hatch-vcs
. No manual version updates in pyproject.toml
are required.
# For stable release
git tag v0.2.0
git push origin v0.2.0
# For prerelease
git tag v0.2.0a1
git push origin v0.2.0a1
2. Monitor Workflow
The appropriate workflow will automatically:
- Run tests (lint, type check, pytest)
- Build the package with version from Git tag
- Publish to PyPI
- Publish to GitHub Packages
- Generate changelog from conventional commits
- Create GitHub release with changelog
- Update CHANGELOG.md (for stable releases)
- Upload release assets (wheels and source distributions)
Version Scheme
Automatic Versioning
The project uses hatch-vcs
to automatically determine versions from Git tags, following PEP 440 versioning:
- Alpha:
0.2.0a1
(from tagv0.2.0a1
) - Beta:
0.2.0b1
(from tagv0.2.0b1
) - Release Candidate:
0.2.0rc1
(from tagv0.2.0rc1
) - Stable:
0.2.0
(from tagv0.2.0
) - Development:
0.2.0.dev1+g1234567
(automatically generated for untagged commits)
Tag Format
Tags must follow the format v{version}
where {version}
matches PEP 440:
v0.2.0
→0.2.0
v0.2.0a1
→0.2.0a1
v0.2.0b1
→0.2.0b1
v0.2.0rc1
→0.2.0rc1
Security
- Trusted Publishing: Uses OpenID Connect (OIDC) for secure authentication with PyPI
- Environment Protection: Production releases require environment approval
- No API Tokens: Avoids storing sensitive API tokens in repository secrets
Testing
Before releasing:
-
Local Testing:
uv run ruff check --fix
uv run mypy
uv run pytest --cov=src -
Test PyPI: Test installation from Test PyPI before tagging:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ oboyu
Changelog Generation
Automatic Changelog
The release workflows automatically generate changelogs based on:
- Pull request titles following conventional commit format
- Commit messages between releases
- GitHub labels on pull requests
Changelog Categories
Changes are organized into categories:
- 🚀 Features - New features and enhancements
- 🐛 Bug Fixes - Bug fixes
- 📚 Documentation - Documentation updates
- 🔧 Maintenance - Chores and refactoring
- 🎨 Style - Code style changes
- 🚨 Tests - Test additions and changes
CHANGELOG.md Updates
For stable releases, the CHANGELOG.md file is automatically updated with:
- Version number and release date
- Categorized list of changes
- Links to pull requests and commits
GitHub Packages
Publishing
Both stable and prerelease versions are published to GitHub Packages alongside PyPI. This provides:
- Alternative package registry
- Better integration with GitHub ecosystem
- Package visibility in repository
Installation from GitHub Packages
# Install latest stable
pip install oboyu --index-url https://ghcr.io/sonesuke/oboyu
# Install prerelease
pip install --pre oboyu --index-url https://ghcr.io/sonesuke/oboyu
Troubleshooting
Tag Format Error
If the workflow fails due to tag format issues:
- Ensure tags follow the
v{version}
format (e.g.,v0.2.0
,v0.2.0a1
) - Verify the tag triggers the correct workflow pattern
- Delete incorrect tags with
git tag -d <tagname>
andgit push origin :refs/tags/<tagname>
Publish Failure
If publishing fails:
- Check environment configuration
- Verify trusted publishing setup on PyPI
- Ensure package name is available on PyPI
Test Failures
If tests fail during the workflow:
- Run tests locally to reproduce the issue
- Fix the failing tests
- Push the fix and re-tag if necessary
Changelog Generation Issues
If changelog is empty or incorrect:
- Ensure pull requests have proper labels
- Verify commit messages follow conventional format
- Check that PRs are merged to the main branch
GitHub Packages Publishing
If GitHub Packages publishing fails:
- Verify repository has packages write permissions
- Check GitHub token has correct scopes
- Ensure package naming follows GitHub requirements