name: Publish to PyPI

on:
  push:
    tags:
      - 'v*'

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write

    steps:
      - uses: actions/checkout@v4

      - uses: astral-sh/setup-uv@v5
        with:
          enable-cache: false

      - name: Install dev dependencies
        run: uv sync --group dev

      - name: Run tests
        run: uv run --no-sync pytest tests/ -v

      - name: Build
        run: uv build

      - name: Publish to PyPI
        run: uv publish
