-
Notifications
You must be signed in to change notification settings - Fork 168
80 lines (68 loc) · 2.74 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
70
71
72
73
74
75
76
77
78
79
80
name: Check links and Publish Docs
on:
pull_request:
push:
branches:
- master
jobs:
rustdocs_user_docs:
name: Build rustdocs, user-docs and check links
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
# rustdocs
- name: Install rustdocs dependencies
run: |
sudo apt update
sudo apt install -y clang libclang-dev libopencv-dev
- name: Rust Cache
uses: Swatinem/[email protected]
with:
working-directory: rust
- name: Generate cargo doc
run: |
cd rust
echo "_____Generating rustdocs to ./docs/book/src dir so it's published from ./rustdocs/"
echo "_____And to check the relative links to the rustdoc while mdbook build_____"
cargo doc --all-features --verbose --no-deps
mv ./target/doc/ ../docs/src/rustdocs/
# user-docs
# they are generated after rustdocs to check the relative links
- name: Setup mdBook
uses: peaceiris/[email protected]
with:
mdbook-version: latest
- name: Install mdbook-linkcheck
uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-linkcheck
- name: Install mdbook-mermaid
uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-mermaid
- name: Build user-docs
# docs source dir ./docs/book/html/
run: |
mdbook build docs
echo "_____Hosting user-docs from root and rustdocs from ./rustdocs/_____"
echo "_____gh-pages branch would be the size of_____"
du -sh ./docs/book/html/
du -sh ./docs/book/html/*
# deploy
- name: Deploy rustdocs and user-docs
uses: peaceiris/actions-gh-pages@v3
# published only from master
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ github.token }}
force_orphan: true
# this is the only dir that's pushed to gh-pages branch
publish_dir: ./docs/book/html