Publish to PyPI #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_run: | |
workflows: ["Test UV Installation Detection"] | |
types: [completed] | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: release | |
# Only run if tests passed (when triggered by workflow_run) or when manually triggered/tagged | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'push' || | |
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
permissions: | |
id-token: write # Required for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
- name: Set up Python | |
run: uv python install | |
- name: Build package | |
run: uv build | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |