name: Build and Deploy Docs

on:
  push:
    branches: [main]
    paths:
      - "docs/**"
      - "mkdocs.yml"
      - ".github/workflows/static.yml"
      - "pyproject.toml"

permissions:
  contents: write

jobs:
  deploy-docs:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: Install Hatch
        run: pip install hatch

      - name: Install Docs Dependencies
        run: hatch env create docs

      - name: Deploy MkDocs to GitHub Pages
        run: hatch run docs:deploy
