Update README.md (#2414) #5343
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |