-
Notifications
You must be signed in to change notification settings - Fork 168
97 lines (82 loc) · 3.83 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout sources
uses: actions/[email protected]
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/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: rust -> rust/target
- name: Install cargo-spellcheck
uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b # v3.0.0
with:
crate: cargo-spellcheck
- name: Install uniffi_bindgen
uses: actions-rs/[email protected]
with:
crate: uniffi_bindgen
version: 0.22.0 # Must be in sync with version in Cargo.toml
use-tool-cache: true
- name: Run spellcheck
run: |
cargo spellcheck check --cfg=.spellcheck/config.toml -m 99
- 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/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
with:
mdbook-version: latest
- name: Install mdbook-linkcheck
uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b # v3.0.0
with:
crate: mdbook-linkcheck
- name: Install mdbook-mermaid
uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b # v3.0.0
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@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
# published only from master AND if the triggerer is not dependabot
# https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-797125425
if: ${{ github.ref == 'refs/heads/master' && github.actor != 'dependabot[bot]' }}
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