Skip to content

Merge branch 'main' of https://github.com/loning/mbook-binary #118

Merge branch 'main' of https://github.com/loning/mbook-binary

Merge branch 'main' of https://github.com/loning/mbook-binary #118

Workflow file for this run

name: Deploy mdBook site to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.52
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ env.MDBOOK_VERSION }}-mermaid-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ env.MDBOOK_VERSION }}-
${{ runner.os }}-cargo-
- name: Install mdBook
run: |
# Check if mdbook is already installed and has the correct version
if ! command -v mdbook &> /dev/null || ! mdbook --version | grep -q "$MDBOOK_VERSION"; then
cargo install --version ${MDBOOK_VERSION} mdbook
fi
# Check if mdbook-katex is already installed
if ! command -v mdbook-katex &> /dev/null; then
cargo install mdbook-katex
fi
# Check if mdbook-mermaid is already installed
if ! command -v mdbook-mermaid &> /dev/null; then
cargo install mdbook-mermaid
fi
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build with mdBook
run: mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4