name: Publish to PyPI

on:
  workflow_run:
    workflows:
      - Auto Version Tag
    types:
      - completed

jobs:
  publish:
    runs-on: ubuntu-latest
    environment: release
    steps:
      - uses: actions/checkout@v4
      - name: Set up uv
        uses: astral-sh/setup-uv@v6
        with:
          python-version: "${{ matrix.python-version }}"
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
      - name: Compile translations
        run: uv run pybabel compile -d invenio_theme_iform/translations/
      - name: Build package
        run: uv build
      - name: Publish to PyPI
        run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
