name: Documentation # The docs are built on every push so a broken build is caught immediately, but # only published once GitHub Pages has been enabled for the repository. Until the # owner decides to publish, this job builds and stops. # # And on pull requests, where the build is the only check there is: `mkdocs build # --strict` fails on a link to a page that does not exist, and building only after # the merge means finding that out on `main`. Nothing is published from a pull # request — the `deploy` job below runs on a manual dispatch and nothing else. on: push: branches: [main] paths: - 'docs/**' - 'mkdocs.yml' - '.github/workflows/docs.yml' pull_request: paths: - 'docs/**' - 'mkdocs.yml' - '.github/workflows/docs.yml' workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: pages cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' cache: pip cache-dependency-path: docs/requirements.txt - run: pip install -r docs/requirements.txt - run: mkdocs build --strict - uses: actions/upload-pages-artifact@v3 with: path: site_build deploy: needs: build runs-on: ubuntu-latest # Only runs once Pages is enabled. Until then the build above still guards # against a broken docs tree. if: github.event_name == 'workflow_dispatch' environment: name: github-pages url: ${{ steps.deploy.outputs.page_url }} steps: - id: deploy uses: actions/deploy-pages@v4