name: "docs: deploy"

on:
  push:
    branches: [ main ]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pages: write
      id-token: write
    steps:
      - uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      - name: Install uv (tooling)
        run: python -m pip install --upgrade pip && pip install uv

      - name: Install docs dependencies
        run: python -m pip install -r docs/requirements-docs.txt

      - name: Build MkDocs site
        run: uv run mkdocs build --clean

      - name: Deploy to GitHub Pages (gh-pages)
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./site
