name: Deploy Documentation

on:
  push:
    branches:
      - main
      - master
  workflow_dispatch:

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

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full history for git-revision-date-localized plugin
      
      - name: Configure Git Credentials
        run: |
          git config user.name github-actions[bot]
          git config user.email 41898282+github-actions[bot]@users.noreply.github.com
      
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      
      - name: Install uv
        run: |
          curl -LsSf https://astral.sh/uv/install.sh | sh
          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
      
      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          key: mkdocs-material-${{ hashFiles('pyproject.toml') }}
          path: .cache
          restore-keys: |
            mkdocs-material-
      
      - name: Install dependencies
        run: |
          uv pip install mkdocs-material mkdocstrings[python] mkdocs-git-revision-date-localized-plugin mkdocs-click mkdocs-git-authors-plugin --system
          uv pip install -e . --system
      - name: Build documentation
        run: mkdocs build
      
      - name: Deploy to GitHub Pages
        run: mkdocs gh-deploy --force 