Skip to content

Commit 64ed4ee

Browse files
committed
fix: build error
1 parent 290b50d commit 64ed4ee

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

.github/workflows/mdbook.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,17 @@ jobs:
3131
env:
3232
MDBOOK_VERSION: 0.4.52
3333
MDBOOK_MERMAID_VERSION: 0.10.0
34+
CARGO_HOME: ${{ github.workspace }}/.cargo
35+
RUSTUP_HOME: ${{ github.workspace }}/.rustup
36+
PATH: ${{ github.workspace }}/.cargo/bin:$PATH
3437
steps:
3538
- uses: actions/checkout@v4
3639
- name: Install mdBook
37-
run: |
38-
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
39-
rustup update
40-
# Install mdbook v0.4.52 (required for mdbook-embedify compatibility)
41-
cargo install --version ${MDBOOK_VERSION} mdbook
42-
# Install mdbook-mermaid v0.10.0 (compatible with mdbook 0.4.52)
43-
cargo install --version ${MDBOOK_MERMAID_VERSION} mdbook-mermaid
44-
# Install mdbook-embedify (latest version compatible with mdbook 0.4.52)
45-
cargo install mdbook-embedify
40+
run: bash scripts/install-mdbook.sh
41+
env:
42+
REPO_ROOT: ${{ github.workspace }}
43+
MDBOOK_VERSION: ${{ env.MDBOOK_VERSION }}
44+
MDBOOK_MERMAID_VERSION: ${{ env.MDBOOK_MERMAID_VERSION }}
4645
- name: Setup Pages
4746
id: pages
4847
uses: actions/configure-pages@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# We want to ignore our vale StylesPath
22
.github/vale/*
3+
# Rust toolchain when running CI locally (e.g. act)
4+
.rustup
5+
.cargo
36
gqm*[pngmd]
47
book
58
**/dist/

mdbook

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
# Run the project's mdBook (avoids using global mdbook, which may have incompatible embedify).
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
exec "${SCRIPT_DIR}/.cargo/bin/mdbook" "$@"

scripts/install-mdbook.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# Install mdBook and plugins (same versions as CI). Safe to run locally.
3+
# Usage: ./scripts/install-mdbook.sh (from repo root)
4+
set -e
5+
6+
MDBOOK_VERSION="${MDBOOK_VERSION:-0.4.52}"
7+
MDBOOK_MERMAID_VERSION="${MDBOOK_MERMAID_VERSION:-0.10.0}"
8+
9+
# Install into repo so CI and local use the same layout (avoids cross-device issues in act)
10+
REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")}"
11+
export RUSTUP_HOME="${REPO_ROOT}/.rustup"
12+
export CARGO_HOME="${REPO_ROOT}/.cargo"
13+
14+
echo "Installing Rust and mdBook into ${REPO_ROOT} (RUSTUP_HOME=$RUSTUP_HOME, CARGO_HOME=$CARGO_HOME)"
15+
16+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
17+
source "${CARGO_HOME}/env"
18+
rustup update
19+
20+
# Install mdbook v0.4.52 (required for mdbook-embedify compatibility)
21+
cargo install --version "${MDBOOK_VERSION}" mdbook
22+
# Install mdbook-mermaid v0.10.0 (compatible with mdbook 0.4.52)
23+
cargo install --version "${MDBOOK_MERMAID_VERSION}" mdbook-mermaid
24+
# Install mdbook-embedify (latest version compatible with mdbook 0.4.52)
25+
cargo install mdbook-embedify
26+
27+
echo "Done. To build the book, use the project mdbook (do not use your global 'mdbook'):"
28+
echo " ./mdbook build"
29+
echo "Or: source \"${CARGO_HOME}/env\" && mdbook build"

0 commit comments

Comments
 (0)