name: Documentation # Built on every push, and published from main. # # The publishing used to wait for a manual dispatch, with a note saying it would # run "once Pages is enabled". Pages was enabled — and the condition was never # changed, so the site was built forty times and published none of them. What it # showed was a Verdande from before v0.43: /links/, /beacon/ and /notifications/ # all answered 404, months after they were written. Nothing failed, because # building *is* what the job was asked to do. # # The lesson is not about this line. It is that "publish later" needs something # that fails when later arrives — a switch that is off and silent looks exactly # like a switch that is on. # # Pull requests still build and never publish: `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`. 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 # From main, and by hand. Never from a pull request — a fork could otherwise # publish over the site by opening one. if: github.event_name != 'pull_request' environment: name: github-pages url: ${{ steps.deploy.outputs.page_url }} steps: - id: deploy uses: actions/deploy-pages@v4