Skip to content

PyPI publish

PyPI publish #4

Workflow file for this run

name: PyPI publish
on:
workflow_run:
workflows:
- Nox
types:
- completed
# Limit this workflow to a single run at a time per-branch to avoid wasting worker resources
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build project then publish to pypi
runs-on: ubuntu-latest
# Only run when the nox run is a success and we have a version tag
if: github.event.workflow_run.conclusion == 'success'
env:
PYPI_URL: ${{ github.event_name == 'pull_request' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
permissions:
# required for pypa/gh-action-pypi-publish
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/uv-setup
- name: Hatch build
run: |
uv run --only-group release -- hatch --version
uv run --only-group release -- hatch build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: tmp/dist