This document describes how to set up PyPI trusted publishing for the mollerdb package.
Before the release workflow can publish to PyPI, repository maintainers need to configure PyPI trusted publishing.
If the package doesn't exist on PyPI yet, you have two options:
Option A: Manual package upload (for first release)
# Build the package locally
python -m pip install build
python -m build
# Upload to PyPI (you'll need PyPI credentials)
python -m pip install twine
python -m twine upload dist/*Option B: Use TestPyPI first Configure the workflow to publish to TestPyPI first, then copy to production PyPI.
- Go to https://pypi.org/manage/account/publishing/
- Log in with your PyPI account (must be a project owner/maintainer)
- Scroll to "Add a new pending publisher"
- Fill in the following details:
- PyPI Project Name:
mollerdb - Owner:
JeffersonLab - Repository name:
mollerdb - Workflow name:
release.yml - Environment name:
pypi
- PyPI Project Name:
- Click "Add"
For additional protection, configure a GitHub environment:
- Go to the repository settings: https://github.com/JeffersonLab/mollerdb/settings/environments
- Click "New environment"
- Name it
pypi - Add protection rules:
- Required reviewers: Add trusted maintainers who must approve releases
- Deployment branches: Limit to tags matching
v*pattern
Once configured, releases are automatic:
- Update version in
pyproject.toml - Commit:
git commit -am "Bump version to X.Y.Z" - Tag:
git tag vX.Y.Z - Push:
git push origin vX.Y.Z
The workflow will automatically:
- Build wheels for Linux and macOS
- Build for Python 3.10-3.13
- Publish to PyPI using trusted publishing
To test the workflow without publishing:
- Use
workflow_dispatchtrigger to manually run the workflow - Or publish to TestPyPI first by modifying the workflow temporarily
This means trusted publishing is not configured. Follow setup step 2 above.
Check that:
- The workflow has
id-token: writepermission ✅ (already configured) - The environment name in the workflow matches PyPI configuration ✅ (both are
pypi) - The workflow name matches PyPI configuration ✅ (both are
release.yml)
Windows builds may require additional configuration for C++ dependencies. The workflow includes a basic Windows setup, but it may need refinement based on testing.