This document describes how to publish macversiontracker to PyPI using GitHub's Trusted Publisher workflow.
- PyPI Project Name:
macversiontracker - Repository:
docdyhr/versiontracker - Publishing Method: GitHub Actions with Trusted Publishers (OIDC)
Before you can publish, you must configure the Trusted Publisher on PyPI:
-
Click "Add a new pending publisher"
-
Fill in the form with these exact values:
PyPI Project Name: macversiontracker Owner: docdyhr Repository name: versiontracker Workflow name: publish-pypi.yml Environment name: pypi -
Click "Add"
For testing before production releases:
-
Click "Add a new pending publisher"
-
Fill in the form with these exact values:
PyPI Project Name: macversiontracker Owner: docdyhr Repository name: versiontracker Workflow name: publish-pypi.yml Environment name: testpypi -
Click "Add"
This is the primary method for production releases:
-
Update version in
pyproject.toml:version = "0.9.0" # Increment version
-
Update CHANGELOG.md with release notes
-
Commit and push changes:
git add pyproject.toml CHANGELOG.md git commit -m "chore: Bump version to 0.9.0" git push -
Create a git tag:
git tag v0.9.0 git push origin v0.9.0
-
Create GitHub Release:
gh release create v0.9.0 \ --title "v0.9.0 - Release Title" \ --notes "Release notes here"
-
Automated Process:
- GitHub Actions workflow triggers automatically
- Builds the package (wheel + sdist)
- Publishes to PyPI using Trusted Publisher
- Signs distributions with Sigstore
- Uploads artifacts to GitHub Release
For testing or special releases:
- Go to: https://github.com/docdyhr/versiontracker/actions/workflows/publish-pypi.yml
- Click "Run workflow"
- Select:
- Branch:
master(or your target branch) - Environment:
testpypiorpypi
- Branch:
- Click "Run workflow"
For TestPyPI:
- URL: https://test.pypi.org/project/macversiontracker/
- Test installation:
pip install --index-url https://test.pypi.org/simple/ macversiontracker
For Production PyPI:
- URL: https://pypi.org/project/macversiontracker/
- Installation:
pip install macversiontracker
The publishing workflow (.github/workflows/publish-pypi.yml) performs these steps:
- Checkout code
- Set up Python 3.12
- Install build tools (
build,twine) - Build package distributions
- Check distributions with
twine check - Upload as artifacts
publish-to-testpypi:
- Triggered by: Manual workflow dispatch with
environment=testpypi - Downloads build artifacts
- Publishes to test.pypi.org
- Uses OIDC authentication (no API tokens needed)
publish-to-pypi:
- Triggered by: GitHub Release OR manual workflow dispatch with
environment=pypi - Downloads build artifacts
- Publishes to pypi.org
- Uses OIDC authentication (no API tokens needed)
github-release (GitHub Releases only):
- Downloads build artifacts
- Signs with Sigstore for provenance
- Uploads signed artifacts to GitHub Release
Follow Semantic Versioning:
- MAJOR.MINOR.PATCH (e.g.,
1.0.0)- MAJOR: Breaking changes
- MINOR: New features (backwards compatible)
- PATCH: Bug fixes (backwards compatible)
Examples:
0.8.1→0.8.2(bug fix)0.8.1→0.9.0(new feature)0.9.0→1.0.0(first stable release)
Before publishing to production PyPI:
-
Test locally:
python -m build twine check dist/* pip install dist/macversiontracker-*.whl versiontracker --version
-
Publish to TestPyPI:
- Use workflow dispatch with
environment=testpypi - Test installation from TestPyPI
- Use workflow dispatch with
-
Create GitHub Release when ready for production
Solution: Verify that:
- PyPI project name is exactly
macversiontracker - Repository is
docdyhr/versiontracker - Workflow file is
.github/workflows/publish-pypi.yml - Environment name matches (
pypiortestpypi)
Solution:
- The package name may be taken
- Contact PyPI support if you own the project
- Consider a different package name
Solution:
- Ensure the
buildjob completed successfully - Check that
python-package-distributionsartifact exists - Re-run the workflow
Solution:
- You cannot re-upload the same version
- Increment the version number in
pyproject.toml - PyPI versions are immutable
This project uses PyPI's Trusted Publisher feature which:
- No API tokens required: Authentication via GitHub OIDC
- Automatic credential management: GitHub generates short-lived tokens
- Enhanced security: No long-lived secrets in repository
- Audit trail: All publishes logged with GitHub identity
Production releases are automatically signed with Sigstore, providing:
- Cryptographic proof of artifact authenticity
- Transparency log entries for verification
- Signature files (
.sigstore) uploaded to GitHub Releases
After publishing:
- Verify on PyPI: https://pypi.org/project/macversiontracker/
- Check installation:
pip install macversiontracker - Monitor downloads: https://pepy.tech/project/macversiontracker (if available)
- GitHub Release: https://github.com/docdyhr/versiontracker/releases
- PyPI Trusted Publishers Guide
- GitHub Actions PyPI Publish Action
- Python Packaging User Guide
- Semantic Versioning
Last Updated: 2026-01-09 Current Version: 0.8.1 Status: Ready for first publication