name: docs
on:
  release:
    types:
      - published
      - released
      - edited
  workflow_dispatch:

env:
  UV_NO_SYNC: true

jobs:
  deploy-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          lfs: true
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.12"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - name: Install dependencies
        run: |
          uv sync --locked --no-dev --extra doc
      - name: Build documentation
        run: uv run mkdocs build -f ./mkdocs.yml
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./site
