This guide explains how to publish new versions of the vetting-python package to PyPI using automated workflows.
✅ Package Published: vetting-python v0.1.0
✅ GitHub Actions Workflow: Created
⏳ Trusted Publisher: Needs to be configured (see Step 1 below)
-
Go to PyPI: https://pypi.org/manage/account/publishing/
-
Add a new pending publisher with these details:
PyPI Project Name: vetting-python Owner: hichipli Repository name: vetting-python Workflow name: publish.yml Environment name: pypi -
Create Environment in GitHub:
- Go to: https://github.com/hichipli/vetting-python/settings/environments
- Click "New environment"
- Name:
pypi - Add protection rules (recommended):
- ✅ Required reviewers: Add yourself
- ✅ Wait timer: 0 minutes
- ✅ Deployment branches: Selected branches only →
main
The workflow already has the correct permissions:
permissions:
id-token: write # Required for trusted publishing
contents: read-
Create a new release on GitHub:
- Go to: https://github.com/hichipli/vetting-python/releases/new
- Tag:
v1.0.1(example) - Title:
Release v1.0.1 - Description: Release notes
- Click "Publish release"
-
Automatic Publishing: The workflow will automatically:
- Build the package
- Publish to PyPI
- No manual intervention needed!
- Go to Actions: https://github.com/hichipli/vetting-python/actions/workflows/publish.yml
- Click "Run workflow"
- Enter version (e.g.,
1.0.1) or leave empty for current version - Click "Run workflow"
Use the provided scripts for version management:
# Show current version
make version
# Bump version automatically
make bump-patch # 1.0.0 -> 1.0.1
make bump-minor # 1.0.0 -> 1.1.0
make bump-major # 1.0.0 -> 2.0.0
# Create complete release
make release VERSION=1.0.1# Bump patch version and create release
make bump-patch
git push && git push --tags
# Or specify exact version
make release VERSION=1.2.3
git push && git push --tagsUpdate these files manually:
pyproject.toml- version fieldvetting_python/__init__.py- version variableCHANGELOG.md- add new entry
# 1. Update code and commit changes
git add .
git commit -m "Add new feature"
# 2. Bump version (this updates files and creates tag)
make bump-minor
# 3. Push everything
git push && git push --tags
# 4. GitHub Actions will automatically publish to PyPI# 1. Update README, CHANGELOG, documentation
git add .
git commit -m "Prepare for major release"
# 2. Create major version bump
make bump-major
# 3. Push and create GitHub Release
git push && git push --tags
# 4. Go to GitHub and create a detailed releaseOnce configured, you get:
- ✅ No API tokens needed - Automatic authentication
- ✅ Secure publishing - Only from your GitHub repo
- ✅ Audit trail - Full transparency in GitHub Actions
- ✅ Environment protection - Only authorized releases
- ✅ No credential management - GitHub handles everything
# Check if package was published
pip search vetting-python
# Install specific version
pip install vetting-python==1.0.1
# Check package info
pip show vetting-pythonMonitor releases at: https://github.com/hichipli/vetting-python/actions
-
"No such environment: pypi"
- Create the environment in GitHub repository settings
-
"Trusted publisher not configured"
- Add the pending publisher on PyPI as described in Step 1
-
"Permission denied"
- Check workflow permissions include
id-token: write
- Check workflow permissions include
-
"Version already exists"
- Bump version number before publishing
# Test build locally
make build
# Check built packages
python -m twine check dist/*
# Test installation from local build
pip install dist/vetting_python-*.whl- PyPI Project: https://pypi.org/project/vetting-python/
- GitHub Repository: https://github.com/hichipli/vetting-python
- Trusted Publishers Guide: https://docs.pypi.org/trusted-publishers/
- GitHub Actions: https://docs.github.com/en/actions
# Update your code...
git add . && git commit -m "Your changes"
# Release new version
make bump-patch && git push --follow-tags
# Done! Check GitHub Actions for automatic PyPI publishingNote: After setting up the Trusted Publisher (Step 1), all future releases will be completely automated through GitHub Actions! 🚀