This repository uses automated release management powered by Python Semantic Release and Conventional Commits.
The release automation workflow automatically:
- Analyzes commit messages since the last release
- Determines the next version based on conventional commits
- Updates the version in
pyproject.toml - Generates/updates CHANGELOG.md with structured release notes
- Creates a Git tag (e.g.,
v3.4.0) - Publishes a GitHub Release with release notes
All commits should follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
The following commit types determine how versions are bumped:
| Type | Description | Version Bump |
|---|---|---|
fix: |
Bug fixes | Patch (3.3.0 → 3.3.1) |
feat: |
New features | Minor (3.3.0 → 3.4.0) |
BREAKING CHANGE: |
Breaking changes (in footer or with !) |
Major (3.3.0 → 4.0.0) |
perf: |
Performance improvements | Patch (3.3.0 → 3.3.1) |
docs: |
Documentation changes | No release |
style: |
Code style changes | No release |
refactor: |
Code refactoring | No release |
test: |
Test changes | No release |
build: |
Build system changes | No release |
ci: |
CI/CD changes | No release |
chore: |
Maintenance tasks | No release |
git commit -m "fix: correct off-by-one error in pattern matching"git commit -m "feat: add support for time-constrained pattern mining"Option 1 - Using ! suffix:
git commit -m "feat!: redesign API to use async/await pattern
BREAKING CHANGE: All public methods now return coroutines"Option 2 - Using footer:
git commit -m "refactor: change GSP initialization parameters
BREAKING CHANGE: GSP constructor now requires `backend` parameter"git commit -m "feat(cli): add --export-format option for JSON output"
git commit -m "fix(gpu): resolve memory leak in CuPy backend"
git commit -m "docs(readme): update installation instructions"Releases are automatically triggered when commits are pushed to the main branch. The workflow:
- Runs on every push to
main - Analyzes commits since the last release
- If a version bump is warranted (e.g.,
fix:,feat:), it creates a release - If no version bump is needed, the workflow exits gracefully
To preview what the next release will be without making changes:
pip install python-semantic-release==9.17.0
semantic-release version --printTo see what changes would be made:
semantic-release version --no-push --no-tag --no-commit --no-vcs-releaseThe automated release workflow (.github/workflows/release.yml) performs these steps:
- Checkout - Fetches the full Git history
- Setup - Installs Python and Python Semantic Release
- Version - Analyzes commits and bumps version in
pyproject.toml - Changelog - Generates/updates
CHANGELOG.md - Commit - Commits version and changelog changes
- Tag - Creates an annotated Git tag
- Release - Creates a GitHub Release with release notes (no assets)
The existing publish.yml workflow then triggers on release creation to build and upload distribution assets.
To enable the automated release workflow to work with branch protection rules, you need to configure the protection rules to allow the workflow to push:
-
Go to repository Settings → Branches → Branch protection rules for
master -
Under "Restrict who can push to matching branches":
- Enable "Restrict pushes that create matching branches"
- Add "github-actions" as an allowed actor
- Or uncheck "Include administrators" to allow bypassing
-
For "Require signed commits":
- Disable this requirement for automated releases, OR
- Configure the workflow with GPG signing (see below)
-
For "Require status checks to pass":
- Ensure the release workflow itself is not listed as a required check
- This prevents circular dependencies
If you need stricter control, create a PAT with bypass permissions:
- Create an organization-wide fine-grained Personal Access Token with:
- Resource owner: your GitHub organization
- Repository access: All repositories (or a restricted set that includes this repository)
- Permissions: Metadata (read), Contents (read/write), Workflows (read/write)
- Enable "Allow bypassing branch protection"
- Add as an organization secret (or repository secret, if preferred):
ORG_RELEASE_TOKEN - Update workflow to use:
token: ${{ secrets.ORG_RELEASE_TOKEN }}
Release automation is configured in pyproject.toml:
[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
branch = "main"
upload_to_vcs_release = false # Assets uploaded by publish.yml
upload_to_pypi = false # PyPI publishing handled separately
build_command = "python -m build"
tag_format = "v{version}"
[tool.semantic_release.commit_parser_options]
allowed_tags = ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]The automated release workflow complements the existing publish.yml workflow:
- release.yml - Creates GitHub releases with tags from conventional commits
- publish.yml - Builds package, uploads assets to release, and publishes to PyPI
This separation allows:
- Automated version management and release notes
- Controlled PyPI publishing with SBOM generation and Sigstore signing
- No duplicate asset uploads
This separation allows:
- Automated releases on every significant commit to
main - Manual control over PyPI publishing (triggered by GitHub releases)
- SBOM generation and Sigstore signing during PyPI publication
- Use conventional commits for all commits
- Include scope when relevant (e.g.,
feat(cli):,fix(gpu):) - Write clear descriptions in the commit message
- Add body/footer for complex changes
- Mark breaking changes explicitly with
BREAKING CHANGE:or!
- Review commit messages in PRs to ensure they follow conventions
- Squash merge PRs with a proper conventional commit message
- Monitor release workflow for successful execution
- Verify changelogs are accurate and complete
- Update documentation when releasing breaking changes
Error: remote: error: GH013: Repository rule violations found
This occurs when the repository has branch protection rules that block the workflow. Solutions:
-
Allow GitHub Actions to bypass protection (Recommended):
- Go to Settings → Branches → Edit branch protection rule for
master - Under "Restrict who can push to matching branches", add "github-actions" as allowed
- Ensure "Require signed commits" is disabled or configure GPG signing
- Go to Settings → Branches → Edit branch protection rule for
-
Adjust required status checks:
- Don't require the release workflow itself as a status check
- This prevents circular dependencies
-
Use a PAT with bypass permissions (if stricter control needed):
- See "Branch Protection Configuration" section above
This means no commits since the last release warrant a version bump. Only commits with types fix:, feat:, perf:, or BREAKING CHANGE: trigger releases.
Check the workflow logs in GitHub Actions. Common issues:
- Git conflicts (rare, usually self-resolving)
- Missing permissions (check
GITHUB_TOKENpermissions) - Invalid commit messages (check conventional commit format)
Ensure commits follow the conventional commit format. The changelog generator only parses properly formatted commits.