name: Deploy documentation to GitHub Pages

on:
  push:
    branches:
      - main
    paths:
      - "docs-site/**"
      - ".github/workflows/pages.yml"
      - "README.md"
  workflow_dispatch:

permissions:
  contents: write

concurrency:
  group: pages-deploy
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
          cache: pip
          cache-dependency-path: docs-site/requirements.txt

      - name: Install MkDocs Material
        run: pip install -r docs-site/requirements.txt

      - name: Build site
        run: mkdocs build -f docs-site/mkdocs.yml

      - name: Deploy to gh-pages branch
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs-site/site
          force_orphan: true
          enable_jekyll: false
