name: PyPI Release

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'
  workflow_dispatch:

jobs:
  pypi-publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write  # For trusted publishing

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install uv
        uses: astral-sh/setup-uv@v4

      - name: Build package
        run: |
          uv build

      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
