name: Upload Python Package to PyPI when a Release is Created
on:
  release:
    types: [created]
  push:
    tags:
      - "v*"
permissions:
  id-token: write
  contents: read
jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v3
      - run: uv build
      - name: Publish to PyPI (Trusted Publishing)
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: dist