Deploy Documentation to GitHub Pages #101
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
| name: Deploy Documentation to GitHub Pages | |
| # Gate the deploy on CI passing on main so we never publish docs that | |
| # reference a broken build. The `workflow_run` trigger fires only after | |
| # the named workflow completes, regardless of its conclusion — we then | |
| # filter on `workflow_run.conclusion == 'success'` below. | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| branches: [main] | |
| types: [completed] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| pip install poetry | |
| poetry install --with docs | |
| - name: Build documentation | |
| run: poetry run mkdocs build | |
| - name: Deploy to GitHub Pages (gh-pages branch) | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site | |
| publish_branch: gh-pages |