112 lines
3.3 KiB
YAML
112 lines
3.3 KiB
YAML
name: Docs
|
|
|
|
# Ensures that only one workflow task will run at a time. Previous deployments, if
|
|
# already in process, won't get cancelled. Instead, we let the first to complete
|
|
# then queue the latest pending workflow, cancelling any workflows in between
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
# doc source files
|
|
- 'book/**'
|
|
- '**/firebase.json'
|
|
- 'katex-header.html'
|
|
# rustdoc source files
|
|
- '**/*.rs'
|
|
- '**/Cargo.toml'
|
|
- '**/Cargo.lock'
|
|
# configuration files
|
|
- '.cargo/config.toml'
|
|
- '**/clippy.toml'
|
|
# workflow definitions
|
|
- '.github/workflows/docs.yml'
|
|
|
|
env:
|
|
RUST_LOG: ${{ vars.RUST_LOG }}
|
|
RUST_BACKTRACE: ${{ vars.RUST_BACKTRACE }}
|
|
RUST_LIB_BACKTRACE: ${{ vars.RUST_LIB_BACKTRACE }}
|
|
COLORBT_SHOW_HIDDEN: ${{ vars.COLORBT_SHOW_HIDDEN }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Deploy Docs (+beta)
|
|
timeout-minutes: 45
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout the source code
|
|
uses: actions/checkout@v3.5.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install last version of Protoc
|
|
uses: arduino/setup-protoc@v1.1.2
|
|
with:
|
|
# TODO: increase to latest version after https://github.com/arduino/setup-protoc/issues/33 is fixed
|
|
version: '3.20.1'
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Setup Rust with beta toolchain and default profile (to include rust-docs)
|
|
- name: Setup Rust
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=beta --profile=default
|
|
|
|
- uses: Swatinem/rust-cache@v2.2.1
|
|
|
|
- name: Setup mdBook
|
|
uses: peaceiris/actions-mdbook@v1.2.0
|
|
with:
|
|
mdbook-version: '0.4.18'
|
|
|
|
# TODO: actions-mdbook does not yet have an option to install mdbook-mermaid https://github.com/peaceiris/actions-mdbook/issues/426
|
|
- name: Install mdbook
|
|
run: |
|
|
cargo install mdbook-mermaid
|
|
|
|
- name: Build Zebra book
|
|
run: |
|
|
mdbook build book/
|
|
|
|
- name: Deploy Zebra book to firebase
|
|
uses: w9jds/firebase-action@v11.30.1
|
|
with:
|
|
args: deploy
|
|
env:
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
PROJECT_PATH: book/
|
|
PROJECT_ID: zebra-book-b535f
|
|
|
|
- name: Build external docs
|
|
run: |
|
|
# Exclude zebra-utils, it is not for library or app users
|
|
cargo doc --no-deps --workspace --all-features --exclude zebra-utils
|
|
env:
|
|
RUSTDOCFLAGS: '--html-in-header katex-header.html'
|
|
|
|
- name: Deploy external docs to firebase
|
|
uses: w9jds/firebase-action@v11.30.1
|
|
with:
|
|
args: deploy
|
|
env:
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
PROJECT_ID: zebra-doc-external
|
|
|
|
- name: Build internal docs
|
|
run: |
|
|
cargo doc --no-deps --workspace --all-features --document-private-items
|
|
env:
|
|
RUSTDOCFLAGS: '--html-in-header katex-header.html'
|
|
|
|
- name: Deploy internal docs to firebase
|
|
uses: w9jds/firebase-action@v11.30.1
|
|
with:
|
|
args: deploy
|
|
env:
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
PROJECT_ID: zebra-doc-internal-e9fd4
|