2021-02-20 03:31:12 -08:00
|
|
|
name: Docs
|
|
|
|
|
2022-08-29 17:11:05 -07:00
|
|
|
# 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
|
|
|
|
|
2021-02-20 03:31:12 -08:00
|
|
|
on:
|
2021-03-03 13:59:01 -08:00
|
|
|
workflow_dispatch:
|
2021-02-20 03:31:12 -08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-02-11 06:05:19 -08:00
|
|
|
paths:
|
2022-03-02 06:23:05 -08:00
|
|
|
# doc source files
|
2022-01-25 03:58:11 -08:00
|
|
|
- 'book/**'
|
|
|
|
- '**/firebase.json'
|
|
|
|
- 'katex-header.html'
|
2022-03-02 06:23:05 -08:00
|
|
|
# rustdoc source files
|
|
|
|
- '**/*.rs'
|
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
2023-01-24 08:27:56 -08:00
|
|
|
# configuration files
|
|
|
|
- '.cargo/config.toml'
|
|
|
|
- '**/clippy.toml'
|
2022-03-02 06:23:05 -08:00
|
|
|
# workflow definitions
|
2022-01-25 03:58:11 -08:00
|
|
|
- '.github/workflows/docs.yml'
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2022-08-22 20:43:18 -07:00
|
|
|
env:
|
2023-04-12 23:56:21 -07:00
|
|
|
RUST_LOG: ${{ vars.RUST_LOG }}
|
|
|
|
RUST_BACKTRACE: ${{ vars.RUST_BACKTRACE }}
|
|
|
|
RUST_LIB_BACKTRACE: ${{ vars.RUST_LIB_BACKTRACE }}
|
|
|
|
COLORBT_SHOW_HIDDEN: ${{ vars.COLORBT_SHOW_HIDDEN }}
|
2022-08-22 20:43:18 -07:00
|
|
|
|
2021-02-20 03:31:12 -08:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build and Deploy Docs (+beta)
|
2022-04-28 15:01:23 -07:00
|
|
|
timeout-minutes: 45
|
2021-02-20 03:31:12 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Checkout the source code
|
2023-06-09 17:59:58 -07:00
|
|
|
uses: actions/checkout@v3.5.3
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2021-06-13 14:30:21 -07:00
|
|
|
|
2022-09-06 07:49:18 -07:00
|
|
|
- name: Install last version of Protoc
|
2023-06-05 19:05:31 -07:00
|
|
|
uses: arduino/setup-protoc@v2.0.0
|
2022-09-06 07:49:18 -07:00
|
|
|
with:
|
2023-01-10 13:22:03 -08:00
|
|
|
# TODO: increase to latest version after https://github.com/arduino/setup-protoc/issues/33 is fixed
|
2023-06-05 19:05:31 -07:00
|
|
|
version: '23.x'
|
2022-09-06 07:49:18 -07:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
# 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
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2023-07-04 19:09:45 -07:00
|
|
|
- uses: Swatinem/rust-cache@v2.5.1
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2022-06-16 22:29:50 -07:00
|
|
|
- name: Setup mdBook
|
2022-10-24 12:48:58 -07:00
|
|
|
uses: peaceiris/actions-mdbook@v1.2.0
|
2022-06-16 22:29:50 -07:00
|
|
|
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
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Install mdbook
|
|
|
|
run: |
|
2022-05-09 13:29:49 -07:00
|
|
|
cargo install mdbook-mermaid
|
2021-06-13 14:30:21 -07:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Build Zebra book
|
|
|
|
run: |
|
|
|
|
mdbook build book/
|
2021-06-13 14:30:21 -07:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Deploy Zebra book to firebase
|
2023-06-19 17:33:51 -07:00
|
|
|
uses: w9jds/firebase-action@v12.4.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
args: deploy
|
|
|
|
env:
|
|
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
|
|
PROJECT_PATH: book/
|
|
|
|
PROJECT_ID: zebra-book-b535f
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Build external docs
|
|
|
|
run: |
|
|
|
|
# Exclude zebra-utils, it is not for library or app users
|
2022-09-14 12:53:08 -07:00
|
|
|
cargo doc --no-deps --workspace --all-features --exclude zebra-utils
|
2022-04-11 22:06:37 -07:00
|
|
|
env:
|
|
|
|
RUSTDOCFLAGS: '--html-in-header katex-header.html'
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Deploy external docs to firebase
|
2023-06-19 17:33:51 -07:00
|
|
|
uses: w9jds/firebase-action@v12.4.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
args: deploy
|
|
|
|
env:
|
|
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
|
|
PROJECT_ID: zebra-doc-external
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Build internal docs
|
|
|
|
run: |
|
2022-09-14 12:53:08 -07:00
|
|
|
cargo doc --no-deps --workspace --all-features --document-private-items
|
2022-04-11 22:06:37 -07:00
|
|
|
env:
|
|
|
|
RUSTDOCFLAGS: '--html-in-header katex-header.html'
|
2021-02-20 03:31:12 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Deploy internal docs to firebase
|
2023-06-19 17:33:51 -07:00
|
|
|
uses: w9jds/firebase-action@v12.4.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
args: deploy
|
|
|
|
env:
|
|
|
|
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
|
|
|
PROJECT_ID: zebra-doc-internal-e9fd4
|