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
name: Deploy docs
on:
push:
branches:
# Deliberately narrower than docs.yml: examples / snippet sources / Cargo.toml feed the
# rendered site but must not trigger a deploy on their own, or a code-only merge after a
# version bump would publish stale docs under the new version. A snippet-only change is
# deployed by the next docs change or manually via workflow_dispatch.
paths:
- docs/**
- properdocs.yml
- overrides/**
workflow_dispatch:
permissions:
contents: write
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
deploy:
name: Deploy versioned docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install docs toolchain
run: pip install -r docs/requirements.txt
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Deploy with mike
run: |
version="$(sed -nE 's/^version = "([0-9]+)\.([0-9]+).*/\1.\2/p' Cargo.toml | head -1)"
mike deploy --update-aliases "$version" latest
mike set-default latest
# mike records every deploy as a new commit on gh-pages, and each commit carries a full
# copy of the rendered site, so the branch grows without bound (GitHub keeps the whole
# history). Serving only needs the latest tree: rewrite the branch to a single commit
# holding the current site and force-push, the same fix faststream applies to its docs
# pipeline. mike itself only reads the branch tree (all deployed versions live side by
# side in it), never the history, so squashing is invisible to the next deploy.
- name: Squash gh-pages history and push
run: |
git checkout gh-pages
git reset --hard "$(git commit-tree -m 'docs: deploy' 'HEAD^{tree}')"
git push --force origin gh-pages