Maintainer-only runbook for publishing new releases of infrahub-sync to PyPI.
The project uses an automated release system powered by GitHub Actions. There are three ways to publish a release:
- Automated release (recommended for regular releases)
- Manual GitHub release (for controlled releases)
- Manual workflow dispatch (for emergency or custom releases)
Before publishing, ensure:
- You have write access to the repository
- The
PYPI_TOKENsecret is configured in repository settings - The
GH_INFRAHUB_BOT_TOKENsecret is configured (for automated releases)
This is the standard release flow. Releases are triggered automatically when PRs are merged to main or stable branches.
Apply appropriate labels to PRs before merging. Labels determine the version bump:
| Label | Version Bump | Use When |
|---|---|---|
changes/major, type/breaking-change |
Major (1.0.0 → 2.0.0) | Breaking API changes |
changes/minor, type/feature, type/refactoring |
Minor (1.0.0 → 1.1.0) | New features, refactoring |
changes/patch, type/bug, type/housekeeping, type/documentation |
Patch (1.0.0 → 1.0.1) | Bug fixes, docs, maintenance |
Auto-labeling rules are configured in .github/release-drafter.yml but require a separate workflow trigger to activate. For now, apply labels manually:
| PR Title Pattern | Recommended Label |
|---|---|
Contains fix |
type/bug |
Contains enhance, improve, feature |
type/feature |
Contains chore |
ci/skip-changelog |
Contains deprecat |
type/deprecated |
Merge your labeled PR to the main branch. The automation will:
- Calculate the next version based on PR labels
- Update
pyproject.tomlwith the new version (and regenerateuv.lock) - Commit changes as
chore(release): v{VERSION} [skip ci] - Create/update a draft GitHub Release with auto-generated release notes
- Navigate to the repository's Releases page
- Find the draft release created by Release Drafter
- Review the auto-generated release notes
- Edit if needed (add context, highlights, migration notes)
- Click Publish release
Publishing the release triggers the PyPI upload automatically.
Use this method when you want full control over the release timing and notes.
Update the version in pyproject.toml:
# Edit pyproject.toml and update the version field
uv lockCommit and push the changes:
git add pyproject.toml uv.lock
git commit -m "chore(release): vX.Y.Z"
git push origin main- Go to Releases → Draft a new release
- Click Choose a tag and create a new tag matching your version (for example,
1.6.0) - Set the target to
mainbranch - Add a release title (for example,
1.6.0) - Write release notes describing the changes
- Click Publish release
This triggers the trigger-release.yml workflow, which publishes to PyPI.
Use this for emergency releases or when you need to bypass the standard flow.
- Go to Actions → Publish Infrahub Sync Package
- Click Run workflow
- Configure the inputs:
version: The version string (for example,1.6.0) - optional, for labelingpublish: Set totrueto publish to PyPI (default:false)runs-on: OS for the runner (default:ubuntu-22.04)
- Click Run workflow
gh workflow run workflow-publish.yml \
--field version="1.6.0" \
--field publish=trueImportant: When using workflow dispatch, ensure pyproject.toml already has the correct version, as this method builds from the current code state.
Release notes are auto-generated based on merged PRs and their labels:
| Category | Labels |
|---|---|
| Breaking Changes | changes/major |
| Minor Changes | changes/minor, type/feature, type/refactoring |
| Patch & Bug Fixes | type/bug, changes/patch |
| Documentation Change | type/documentation |
PRs with these labels are excluded from release notes:
ci/skip-changelogtype/duplicate
After publishing:
- Check PyPI: Visit pypi.org/project/infrahub-sync to confirm the new version is available
- Check GitHub Actions: Ensure the publish workflow completed successfully
- Test Installation:
pip install infrahub-sync==<new-version>
infrahub-sync --versionThe automated release is skipped when:
- The commit author is
opsmill-botwith achoreprefix (prevents recursive releases) - No version bump is detected (no labeled PRs since last release)
- Changes are only in the
docs/directory
Common causes:
PYPI_TOKENsecret is missing or invalid- Version already exists on PyPI (versions cannot be overwritten)
- Network issues during upload
To retry, use the manual workflow dispatch method.
Ensure PRs have appropriate labels before merging. If labels are missing, the version drafter may not calculate a new version.
| Workflow | Type | Purpose |
|---|---|---|
trigger-push-stable.yml |
Push to main/stable |
Calculates version, bumps pyproject.toml, triggers release draft |
workflow-release-drafter.yml |
Reusable (workflow_call) |
Creates/updates GitHub Release draft; invoked by trigger-release.yml |
trigger-release.yml |
GitHub Release published | Orchestrates release: invokes release drafter and publish workflows |
workflow-publish.yml |
Reusable (workflow_dispatch) |
Builds and publishes package to PyPI; invoked by trigger-release.yml |