Skip to content

PyPI Upload

PyPI Upload #41

Workflow file for this run

name: PyPI Upload
on:
workflow_run:
workflows: ["Python CI"]
types:
- completed
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
# Only publish on successful CI runs for tags starting with 'v' (e.g., v1.2.3)
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
startsWith(github.event.workflow_run.head_branch, 'v')
permissions:
contents: read
id-token: write
actions: read
env:
UV_LOCKED: true
UV_COMPILE_BYTECODE: true
UV_NO_EDITABLE: true
UV_NO_PROGRESS: true
UV_NO_SYNC: true
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
# https://docs.astral.sh/uv/guides/integration/github/#using-uv-in-github-actions
# It is considered best practice to pin to a specific uv version
version: "0.9.26"
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: uv.lock
- name: Download Python package artifact
uses: actions/download-artifact@v7
with:
name: python-package
path: dist/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install package from wheel
run: uv pip install dist/*.whl
- name: Run functional tests
run: uv run pytest -m functional
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}