name: Build and Deploy Docs on: push: branches: [ "main" ] paths: - "docs/**" - "mkdocs.yml" - "requirements-dev.txt" - ".github/workflows/docs.yml" workflow_dispatch: # Allow manual trigger jobs: build-and-deploy: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout repo uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install mkdocs and dependencies run: | python -m pip install --upgrade pip pip install mkdocs mkdocs-material - name: Build docs run: | mkdocs build --clean --strict 2>&1 || mkdocs build --clean continue-on-error: false - name: Deploy to GitHub Pages if: ${{ github.ref == 'refs/heads/main' }} uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./site publish_branch: gh-pages