name: Documentation on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: permissions: contents: read pages: write id-token: write jobs: build: name: Build documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install Sphinx dependencies run: | python -m pip install --upgrade pip pip install sphinx pydata-sphinx-theme sphinx-copybutton sphinx-design - name: Build documentation run: | cd docs make html - name: Check for errors run: | cd docs make html 2>&1 | tee build.log if grep -i "error" build.log; then echo "Documentation build has errors" exit 1 fi - name: Upload documentation artifacts uses: actions/upload-artifact@v4 with: name: documentation path: docs/build/html/ - name: Setup Pages if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: actions/configure-pages@v4 - name: Upload to GitHub Pages if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: actions/upload-pages-artifact@v3 with: path: docs/build/html/ - name: Deploy to GitHub Pages if: github.event_name == 'push' && github.ref == 'refs/heads/main' id: deployment uses: actions/deploy-pages@v4