name: Publish to PyPI

on:
  release:
    types: [published]

jobs:
  publish_PyPI:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          tags: true
      - name: Set up Python 3.9
        uses: actions/setup-python@v3
        with:
          python-version: "3.9"
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          enable-cache: true
      - name: Install dependencies
        run: uv sync --dev
      - name: build
        run: uv build
      - name: Publish to PyPI
        run: uv publish --token ${{ secrets.PYPI }}
