name: Documentation
on:
workflow_dispatch:
workflow_call:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache cargo dependencies
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
docs/doc-utils/target
key: ${{ runner.os }}-docs-${{ hashFiles('docs/doc-utils/Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-docs-
- uses: jontze/action-mdbook@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build docs preprocessor
run: cargo build --manifest-path docs/doc-utils/Cargo.toml
- name: Build documentation
run: mdbook build docs
- name: Upload Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v5
with:
path: docs/book
deploy:
name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5