Publish #27
This file contains 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 | |
on: | |
workflow_run: | |
workflows: ['Test suite'] | |
types: [completed] | |
jobs: | |
pypi-publish: | |
name: Build package and upload it to PyPI | |
runs-on: ubuntu-latest | |
# Run only on tags and if test suite was successful | |
if: ${{ github.ref_type == 'tag' && github.event.workflow_run.conclusion == 'success' }} | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: pypi | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Build package | |
run: uv build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |