-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (63 loc) · 1.98 KB
/
docs.yml
File metadata and controls
77 lines (63 loc) · 1.98 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
# contents:write is required to push to the gh-pages branch directly
# (the previous pages:write + id-token:write approach used the Pages API instead)
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.52'
- name: Install mdbook-mermaid
run: cargo install mdbook-mermaid@0.16.0
- name: Build documentation
run: |
cd docs
# Override site-url for versioned path
sed -i 's|site-url = "/torc/"|site-url = "/torc/latest/"|' book.toml
mdbook build
- name: Setup gh-pages branch
run: .github/scripts/gh-pages-setup.sh
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Deploy latest docs
run: |
cd gh-pages-deploy
# One-time: clean legacy Sphinx content
rm -rf _static _sources _images genindex.html objects.inv searchindex.js \
py-modindex.html search.html .buildinfo
# Replace latest/ with new build
rm -rf latest
cp -r ../docs/book latest
# Root redirect
cp ../docs/redirect.html index.html
# Initialize versions.json if it doesn't exist
if [ ! -f versions.json ]; then
cat > versions.json << 'VJSON'
{
"latest_release": null,
"versions": [
{"version": "latest", "label": "latest (main)", "path": "/torc/latest/"}
]
}
VJSON
fi
- name: Commit and push
run: |
cd gh-pages-deploy
../.github/scripts/gh-pages-commit.sh "Deploy docs from ${GITHUB_SHA::8}"