Skip to content

Generate documentation per-release #348

Generate documentation per-release

Generate documentation per-release #348

Workflow file for this run

name: Deploy Documentation
on:
workflow_dispatch:
push:
branches: [main]
tags: [v*]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ github.event.release.tag_name || 'main' }}
- name: Setup Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-cache-${{ hashFiles('Cargo.lock') }}
- name: Install dependencies
run: |
cargo install mdbook mdbook-mermaid mdbook-toc
- name: Build MDBook
run: |
if [ -d "docs" ]; then
cd docs
mdbook build
else
echo "Docs folder not found."
fi
- name: Prepare Deploy Folder
run: |
mkdir -p deploy
if [[ $GITHUB_REF == refs/heads/main ]]; then
mv docs/book deploy/
else
version=${GITHUB_REF#refs/tags/v}
mv docs/book deploy/$version
fi
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: deploy
single-commit: true