This document explains how to use the automated release workflow for the apihub-python-client package.
The project has two GitHub Actions workflows for publishing:
publish.yml- Automated release creation and publishing (recommended)publish-on-release.yml- Publish when a release is manually created
The main workflow (publish.yml) automates the entire release process:
- ✅ Automatic version bumping
- ✅ Git tag creation
- ✅ GitHub release creation with auto-generated notes
- ✅ Code quality checks (linting, type checking)
- ✅ Test execution
- ✅ PyPI publishing
- ✅ Support for pre-releases
- ✅ Custom release notes
- Navigate to Actions tab in the GitHub repository
- Select "Release Tag and Publish Package" workflow
- Click "Run workflow"
- Configure the release:
- Version bump type: Choose
patch,minor, ormajor - Pre-release: Check if this is a pre-release version
- Release notes: Optional custom notes (auto-generated notes will also be included)
- Version bump type: Choose
- Click "Run workflow" button
The workflow follows semantic versioning:
- Patch (e.g., 1.2.3 → 1.2.4): Bug fixes, small improvements
- Minor (e.g., 1.2.3 → 1.3.0): New features, backwards compatible
- Major (e.g., 1.2.3 → 2.0.0): Breaking changes
- Version Update: Updates
__version__insrc/apihub_client/__init__.py - Git Operations:
- Commits version change to main branch
- Creates and pushes git tag (e.g.,
v1.2.3)
- Quality Checks:
- Runs linting with
ruff - Executes full test suite with
tox
- Runs linting with
- GitHub Release: Creates release with auto-generated changelog
- PyPI Publishing: Builds and publishes package to PyPI
The workflow requires these repository secrets:
PUSH_TO_MAIN_APP_ID: GitHub App ID for pushing to mainPUSH_TO_MAIN_APP_PRIVATE_KEY: GitHub App private key
And these repository variables:
PUSH_TO_MAIN_APP_ID: GitHub App ID (can be same as secret)
PyPI Setup: This workflow uses PyPI Trusted Publishers with uv publish for secure publishing. You need to:
- Configure the GitHub repository as a trusted publisher on PyPI
- Set up the trusted publisher for the
apihub-python-clientpackage - No API tokens required -
uv publishautomatically handles OIDC authentication
The publish-on-release.yml workflow runs when you manually create a release through GitHub's interface.
- When you need more control over the release process
- For hotfixes or special releases
- When the automated workflow is not available
- Create a release manually through GitHub's release interface
- Use semantic version tag (e.g.,
v1.2.3) - Publish the release - this triggers the workflow automatically
- Ensure all tests pass on the main branch
- Review recent changes and prepare release notes if needed
- Check dependencies are up to date
- Verify documentation is current
- Use patch for bug fixes and small improvements
- Use minor for new features that don't break existing code
- Use major for breaking changes
- Use pre-release for beta/alpha versions
- Let GitHub auto-generate notes for most releases
- Add custom notes for major releases or important changes
- Include migration guides for breaking changes
Workflow fails at version bump:
- Check that the current version in
__init__.pyfollows semantic versioning - Ensure the main branch is up to date
Tests fail during release:
- Check the latest test results on main branch
- Fix failing tests before attempting release
PyPI publish fails:
- Verify PyPI Trusted Publisher is configured correctly
- Check if version already exists on PyPI
- Ensure package builds successfully locally with
uv build - Verify the repository and workflow file match the trusted publisher configuration
- Check that
uv publishhas proper OIDC token access (requiresid-token: writepermission)
Permission errors:
- Verify GitHub App has necessary permissions
- Check that secrets and variables are properly configured
- Check the Actions tab for detailed logs
- Review failed workflow runs for specific error messages
- Create an issue if you encounter persistent problems
Before releasing, you can test the package locally:
# Install dependencies
uv sync --dev
# Run linting
tox -e lint
# Run tests
tox -e py312
# Build package
uv build
# Test installation
pip install dist/*.whl- Never commit API tokens or secrets to the repository
- The workflow uses
uv publishwith PyPI Trusted Publishers for secure, tokenless publishing - GitHub App tokens are used for secure repository access
- All secrets should be stored in GitHub repository settings
- Trusted Publishers with
uv publisheliminate the need for long-lived PyPI API tokens uv publishnatively supports OIDC authentication without additional GitHub Actions
To configure PyPI Trusted Publishers:
- Go to PyPI → Your project → Manage → Publishing
- Add a new trusted publisher with these details:
- Owner:
Unstract(your GitHub organization/username) - Repository name:
apihub-python-client - Workflow filename:
publish.yml - Environment name: Leave empty (unless using GitHub environments)
- Owner:
- Save the configuration
For more details, see: