name: docs # Builds the mdBook site in docs/ and deploys it to GitHub Pages. # One-time setup: repo Settings → Pages → Source = "GitHub Actions". # # Pull requests build the book but never deploy — so a broken book (or a # chapter that {{#include}}s a file that moved) is a red PR check, not a # post-merge surprise. results/** is a trigger because case-study chapters # include evidence files from there. on: push: branches: [main] paths: - "docs/**" - "results/**" - ".github/workflows/docs.yml" pull_request: paths: - "docs/**" - "results/**" - ".github/workflows/docs.yml" workflow_dispatch: permissions: contents: read pages: write id-token: write # Allow one concurrent deployment; don't cancel an in-progress prod deploy. concurrency: group: pages-${{ github.event_name == 'pull_request' && github.ref || 'prod' }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: runs-on: ubuntu-latest env: MDBOOK_VERSION: "0.4.40" steps: - uses: actions/checkout@v4 - name: Configure Pages if: github.event_name != 'pull_request' uses: actions/configure-pages@v5 - name: Install mdBook run: | mkdir -p "$HOME/.local/bin" url="https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" curl -sSL "$url" | tar -xz -C "$HOME/.local/bin" echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Build run: mdbook build docs - name: Upload artifact if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: path: docs/book deploy: if: github.event_name != 'pull_request' needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4