name: docs-release

# on release only
on:
  release:
    types: [published]

jobs:
  docs:
    runs-on: ubuntu-latest
    # if: github.ref == 'refs/heads/master'
    strategy:
      matrix:
        python-version: ["3.12"]
    steps:
      - uses: actions/checkout@v6
      - name: Install uv
        uses: astral-sh/setup-uv@v8.0.0
        with:
          python-version: ${{ matrix.python-version }}
      - name: Build process reference
        run: make api
      - name: Update docs
        run: |
          cp README.md docs/index.md
          git config user.name github-actions
          git config user.email github-actions@github.com
          git fetch origin gh-pages --depth=1
          uv run --group docs mike deploy --push --update-aliases --allow-empty ${{ github.ref_name }} latest
          uv run --group docs mike set-default --push latest
        if: success()
