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. Nothing about a release is edited by hand: dispatching trigger-push-stable.yml prepares a release pull request, and merging that pull request publishes the release.
Preparation is dispatched, not triggered by a merge. It used to fire on every push to main, which re-opened or force-updated the release pull request under whoever was reviewing it — deciding to release is a separate act from merging.
Apply appropriate labels to PRs before merging. Labels determine the version bump:
| Label | Version Bump | Use When |
|---|---|---|
changes/major |
Major (1.0.0 → 2.0.0) | Breaking API changes |
changes/minor |
Minor (1.0.0 → 1.1.0) | New features, refactoring |
changes/patch |
Patch (1.0.0 → 1.0.1) | Bug fixes, docs, maintenance |
The bump labels live in .github/version-drafter.yml. Every normal pull request must have exactly one — release-label-check.yml fails the pull request otherwise; type/* labels classify work but do not affect the release version. Dependabot and update-infrahub-sdk.yml apply changes/patch themselves. Apply the release-intent label manually:
| PR Title Pattern | Recommended Label |
|---|---|
Contains breaking or an incompatible API change |
changes/major |
Contains enhance, improve, feature, or refactor |
changes/minor |
Contains fix, docs, chore, or a dependency update |
changes/patch |
Every pull request into main must also carry a news fragment under changelog/, but no CI check enforces this at present. The pull_request trigger of changelog-check.yml is commented out while the towncrier rollout is reconsidered, so reviewers check for the fragment. Dispatching the workflow manually does not check a pull request: the dispatch event carries no pull request number, so the run fails. ci/skip-changelog remains a separate opt-out for changes that need no release-note entry. See the Changelog section of AGENTS.md.
Merge your labeled PRs to the main branch. Merging does not prepare a release on its own.
When main holds everything you mean to ship, run Actions → Push on main → Run workflow with main selected as the branch.
Leave version empty to have the labels on the pull requests merged since the last release decide it — that is the usual case. Fill it in to state the version yourself, the way infrahub and infrahub-sdk-python do for every release.
trigger-push-stable.yml then:
- Resolves the version — from the input if you gave one, otherwise from the merged PR labels
- Updates
pyproject.tomlwith the new version and regeneratesuv.lock - Assembles
CHANGELOG.mdfrom the news fragments with towncrier, consuming them - Opens a
chore(release): {VERSION}pull request fromrelease/{VERSION}intomain
If there are no news fragments, the run fails rather than cut a version with an empty changelog. Add a fragment — housekeeping is fine — and dispatch again. It also fails when the resolved version is already the latest tag: a dispatch is someone asking for a release, so having nothing to cut is reported rather than passed over.
The release pull request is the reviewable artefact. Read the assembled CHANGELOG.md section in its diff — that is what users will read — and merge when it is right.
Merging it triggers release-publish.yml, which:
- Reads the version back out of
pyproject.toml - Creates the bare tag (for example
2.0.2, notv2.0.2) - Publishes a GitHub Release whose body is the changelog section
Publishing that Release triggers trigger-release.yml and the PyPI upload.
A release is only ever cut by merging a release/* pull request: release-publish.yml refuses to tag a commit that is not one, so a hand-edited version on main cannot publish anything on its own.
Use this method when you want full control over the release timing and notes.
This is an escape hatch and bypasses the changelog: fragments under changelog/ are left unconsumed and CHANGELOG.md is not updated, so the release notes are whatever you type into the GitHub UI. Prefer Method 1. Note also that main is protected — the version bump still has to go through a pull request.
Update the version in pyproject.toml:
# Edit pyproject.toml and update the version field
uv lockCommit the changes on a branch and merge them through a pull request:
git switch -c chore/release-X.Y.Z
git add pyproject.toml uv.lock
git commit -m "chore(release): X.Y.Z"
git push origin chore/release-X.Y.Z- 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 written by contributors, not generated from pull-request titles. Each pull request adds a news fragment under changelog/; towncrier assembles them into CHANGELOG.md when the release pull request is prepared, and release-publish.yml uses that section verbatim as the GitHub Release body.
The seven fragment types come from [tool.towncrier] in pyproject.toml: security, removed, deprecated, added, changed, fixed, housekeeping. See the Changelog section of AGENTS.md for how to add one.
Labels no longer shape the release notes — they only decide the version bump (see Step 1 above).
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 --versionPreparing a release is skipped when:
- The push is the merge of a
release/*pull request (prevents recursive releases) - The commit author is
opsmill-botwith achoreprefix (same, for the older scheme) - No version bump is detected (no labeled PRs since last release)
- Changes are only in the
docs/directory - There are no news fragments under
changelog/— there is nothing to release
The last case is the common one after a run of ci/skip-changelog pull requests. Add a fragment (housekeeping is fine) and dispatch again.
trigger-push-stable.yml fails rather than skips when a news fragment exists but is empty or whitespace-only — it would otherwise render as a changelog heading with nothing under it. The error names the file: fill it in or delete it.
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 |
|---|---|---|
changelog-check.yml |
None (pull_request trigger commented out) |
Requires a news fragment on each pull request into main once its trigger is restored; a manual dispatch has no pull request to check and fails |
release-label-check.yml |
PR into main (pull_request_target) |
Requires exactly one changes/* release bump label; runs as defined on main, so changes to it apply only after merge |
trigger-push-stable.yml |
Dispatched on main |
Resolves the version, bumps pyproject.toml, assembles the changelog, opens the release pull request |
release-publish.yml |
Push to main |
Tags and publishes the GitHub Release when a release/* pull request lands |
trigger-release.yml |
GitHub Release published | Invokes the publish workflow |
workflow-publish.yml |
Reusable (workflow_dispatch) |
Builds and publishes package to PyPI; invoked by trigger-release.yml |