1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy Docs
# Builds the mdbook docs/ site and pushes the rendered HTML to the
# gh-pages branch.
#
# GitHub Pages source must be set to:
# Settings → Pages → Build and deployment → Source: "Deploy from a branch"
# → Branch: gh-pages / (root)
on:
push:
branches:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
# Manual trigger for emergency redeploys (e.g., re-render after a
# mdbook version bump that changes output).
permissions:
contents: read
# Only one deploy at a time; don't cancel in-progress deploys (we want
# every push to land in gh-pages history).
concurrency:
group: pages-deploy
cancel-in-progress: false
env:
MDBOOK_VERSION: "0.5.2" # Pin to match local dev tooling
jobs:
build-and-deploy:
name: Build mdbook + deploy to gh-pages
runs-on: ubuntu-latest
# Token override needed for peaceiris to push to gh-pages.
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install mdbook
# taiki-e/install-action provides pre-built binaries (no cargo
# build), keeping the deploy job under 30s.
uses: taiki-e/install-action@cca35edeb1d01366c2843b68fc3ca441446d73d3 # v2
with:
tool: mdbook@${{ env.MDBOOK_VERSION }}
- name: Build book
run: mdbook build docs
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: docs/book
# No keep_files: the bench dashboard data at /dev/bench/ that
# this used to preserve was retired alongside benches/ and the
# benchmark workflow. Next deploy wipes it cleanly.
commit_message: 'docs: deploy mdbook from ${{ github.sha }}'
user_name: 'github-actions[bot]'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'