name: Release package

on:
  push:
    tags:
      - "v*"

jobs:
  build-test:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version-file: .python-version

      - name: Set up uv
        uses: astral-sh/setup-uv@v5
        with:
          version: 0.6.11

      - name: Install project
        run: uv sync

      - name: Build and publish to PyPI
        env:
          UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
        run: |
          uv build
          uv publish
