-
Notifications
You must be signed in to change notification settings - Fork 123
69 lines (60 loc) · 1.81 KB
/
docs.yml
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
name: 🗒 Documentation
on:
push:
branches:
- main
pull_request:
merge_group:
jobs:
book:
name: 🔨 Build Docs
runs-on: ubuntu-latest
steps:
- name: ⬇ ️Checkout Source
uses: actions/checkout@v2
- name: 🧰 Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y -q \
libasound2-dev \
libudev-dev
- name: 🦀 Install Rust
uses: actions-rs/toolchain@v1
- name: 📖 Install mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.22"
- uses: actions/cache@v3
name: ♻️ Cache Cargo
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
web-target/
key: docs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
docs-
- name: 🔨 Build Rustdoc
run: |
RUSTDOCFLAGS="--html-in-header docs/rustdoc-mermaid-head.html" cargo doc --workspace --no-deps
# Check for broken doc links in diagrams
for link in `grep -hor 'click .* call docLink\(.*\)' target/doc | awk -F '(' '{ print $2 }' | tr -d ')'`; do
if [ ! -e "target/doc/$link" ]; then
echo "broken doc link in diagram to '$link'" 1>&2;
exit 1;
fi
done
mv target/doc book/src/developers/rustdoc
- name: 🛠 Build MDBook
run: |
cd book
mdbook build
- name: 🚀 Deploy
uses: JamesIves/github-pages-deploy-action@4.1.3
if: ${{ github.ref == 'refs/heads/main' }}
with:
branch: gh-pages
folder: ./book/dist
target-folder: book