Release Guide
Publishing to PyPI — Trusted Publishing (OIDC)
This project uses PyPI Trusted Publishing instead of a long-lived API token. GitHub Actions receives a short-lived OIDC token automatically; no secrets need to be stored in the repository.
One-time PyPI setup
- Log in to pypi.org and open your project (or create it first with an initial manual upload).
- Go to Your projects → devpi-gitea-sync → Publishing.
- Under Add a new publisher, choose GitHub and fill in:
- Owner:
veloslab - Repository:
python-devpi-gitea-sync - Workflow name:
publish.yml - Environment name: leave blank
- Click Add.
No PYPI_API_TOKEN secret is needed.
How publishing is triggered
Publishing runs automatically when a GitHub Release is published.
The workflow in .github/workflows/publish.yml has two sequential jobs:
ci job:
1. Unit tests (poetry run pytest)
2. Docs build (poetry run mkdocs build --strict)
build-and-publish job (needs: ci — only runs if CI passes):
1. poetry build
2. pypa/gh-action-pypi-publish (uploads dist/ via OIDC)
Release Steps
1. Verify CI is green locally
2. Create a release branch and bump the version
| Change type | Command |
|---|---|
| Bug fixes only | poetry version patch — e.g. 0.2.0 → 0.2.1 |
| New features, backwards-compatible | poetry version minor — e.g. 0.2.0 → 0.3.0 |
| Breaking changes | poetry version major — e.g. 0.2.0 → 1.0.0 |
3. Commit and open a PR
git add pyproject.toml
git commit -m "Release v0.2.0"
git push origin release/v0.2.0
gh pr create --title "Release v0.2.0" --body "Version bump for v0.2.0."
Wait for CI to pass, then merge.
4. Create a GitHub Release
git checkout main && git pull origin main
gh release create v0.2.0 --title "v0.2.0" --notes "See README for details." --target main
Or via the GitHub UI: Releases → Draft a new release, tag v0.2.0, target main, then Publish release.
5. Verify the release
After the publish workflow completes:
Release Checklist
- [ ] Tests pass locally (
poetry run pytest) - [ ] Docs build cleanly (
poetry run mkdocs build --strict) - [ ]
pyproject.tomlversion bumped viapoetry version - [ ] Release PR merged and CI green
- [ ] GitHub Release published (tag
vX.Y.Z, targetmain) - [ ] Publish workflow succeeded in GitHub Actions
- [ ] Package installs cleanly from PyPI