name: Build Docs
on:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
tool: mdbook
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ runner.os }}-doc-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-doc-cargo-
- name: Build documentation
run: |
cargo fetch --locked
(cd resource-tracker-rs-book && mdbook build)
cargo doc --no-deps --offline --locked --target-dir resource-tracker-rs-book/book/cargo/
rm -rf resource-tracker-rs-book/book/cargo/debug
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: resource-tracker-rs-book/book
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4