Skip to content

Publish Python Package to PyPI #1

Publish Python Package to PyPI

Publish Python Package to PyPI #1

name: Publish Python Package to PyPI
on:
release:
types: [created]
workflow_run:
workflows: ["Bump Version"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'release' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')) && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || 'main' }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install uv
- name: Build and publish
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
uv build --no-sources
uv publish --token $PYPI_API_TOKEN