Docs #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deploy static site to GitHub Pages (repo Settings → Pages → Source: GitHub Actions). | |
| name: Docs | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: github-pages | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -e ".[docs]" | |
| - name: Build MkDocs (strict) | |
| run: mkdocs build --strict | |
| - name: Disable Jekyll (avoid 404 on paths with _) | |
| run: touch site/.nojekyll | |
| - name: Check Pages is enabled (required once) | |
| id: pages_check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| try { | |
| await github.rest.repos.getPagesSite({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }) | |
| core.setOutput("enabled", "true") | |
| } catch (e) { | |
| // GitHub returns 404 when Pages isn't enabled for the repo. | |
| core.setOutput("enabled", "false") | |
| } | |
| - name: Fail with instructions if Pages disabled | |
| if: steps.pages_check.outputs.enabled != 'true' | |
| run: | | |
| echo "::error::GitHub Pages is not enabled for this repository yet." | |
| echo "Enable it once at: Settings → Pages → Build and deployment → Source = GitHub Actions" | |
| exit 1 | |
| - uses: actions/configure-pages@v4 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |