name: Deploy Pages
on:
  push:
    branches:
      - main
    paths:
      - 'docs/**'
      - 'mkdocs.yml'
  workflow_dispatch:
permissions:
  contents: write # write to gh-pages branch
jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
        sparse-checkout: |
          docs
        lfs: true
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: 3.x
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r docs/mkdocs/assets/requirements.txt
    - name: Build MkDocs site
      run: |
        mkdocs build --strict --verbose --site-dir public -f docs/mkdocs.yml
    - name: Deploy to GitHub Pages
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./docs/public
