Plugin: publisher-pypi
Builds Python source and wheel distributions with python -m build and uploads dist/* artifacts to PyPI (or TestPyPI / private indexes) using twine upload.
Installation
Section titled “Installation”Binary
Section titled “Binary”semrel plugin install @semrel/publisher-pypisemrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.
Docker
Section titled “Docker”Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:
docker pull ghcr.io/semrels/publisher-pypi:latestVerify the image signature with cosign:
cosign verify ghcr.io/semrels/publisher-pypi:latest \ --certificate-identity-regexp 'https://github.com/SemRels/publisher-pypi/.github/workflows/release.yml.*' \ --certificate-oidc-issuer https://token.actions.githubusercontent.comConfiguration
Section titled “Configuration”version: 1plugins: - uses: @semrel/updater-python phase: pre-tag args: file: pyproject.toml
- uses: @semrel/publisher-pypi phase: release args: pypi_token: '${env.PYPI_API_TOKEN}' # Optional: target TestPyPI or a private index # pypi_repository_url: "https://test.pypi.org/legacy/"Environment Variables
Section titled “Environment Variables”| Name | Required | Default | Description |
|---|---|---|---|
SEMREL_PLUGIN_PYPI_TOKEN | yes (unless dry-run) | — | PyPI API token passed as TWINE_PASSWORD (__token__ username). |
SEMREL_PLUGIN_PYPI_REPOSITORY_URL | no | PyPI default | Custom repository URL passed to twine upload --repository-url (e.g. https://test.pypi.org/legacy/). |
SEMREL_PLUGIN_WORKDIR | no | . | Project directory where python -m build and dist/ are evaluated. |
SEMREL_PLUGIN_PYTHON_BIN | no | python / python3 | Override the Python executable name or path. |
SEMREL_PLUGIN_TWINE_BIN | no | twine | Override the twine executable name or path. |
Release Context Variables
Section titled “Release Context Variables”SEMREL_VERSIONSEMREL_NEXT_VERSIONSEMREL_DRY_RUN
Behavior
Section titled “Behavior”- Detects
pythonorpython3on$PATH. - Runs
python -m buildin the configured working directory. - Collects artifacts in
dist/*. - Uploads distributions via
twine upload(or logs the planned artifacts without uploading whenSEMREL_DRY_RUN=true).