-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (97 loc) · 3.63 KB
/
deploy.yml
File metadata and controls
108 lines (97 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Build the tutorial mdBook on every push to `master` and deploy it
# to GitHub Pages. The site URL is determined by the repo name —
# project pages always live at `<org>.github.io/<repo>/`, so with
# the repo named `tutorial` the deployed URL is
# `rustviz.github.io/tutorial/`.
name: deploy
on:
push:
branches: [master]
# Manual trigger so we can re-deploy without a push.
workflow_dispatch:
permissions:
contents: read
# Required by actions/deploy-pages.
pages: write
id-token: write
# Don't queue concurrent deploys — newer pushes win and old ones
# get cancelled mid-build.
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# The RustViz plugin links against `rustc_private`, which pins
# the toolchain. Keep this in sync with `rust-toolchain.toml`
# in the rustviz/rustviz repo.
RUST_NIGHTLY: nightly-2025-08-20
# The plugin source repo. We clone its main and
# `cargo install --path` the two binaries we need.
PLUGIN_REPO: rustviz/rustviz
steps:
- uses: actions/checkout@v5
- name: Install nightly toolchain
run: |
rustup toolchain install $RUST_NIGHTLY \
--profile minimal \
--component rust-src,rustc-dev,llvm-tools-preview
rustup default $RUST_NIGHTLY
rustc --version
# Cache the cargo registry + the installed plugin/preprocessor
# binaries. The slow step is `cargo install --path …` for the
# rustc-plugin (5+ minutes); cache hits make subsequent runs
# take a few seconds.
- name: Cache cargo registry + installed binaries
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ runner.os }}-rustviz-tutorial-${{ env.RUST_NIGHTLY }}-${{ hashFiles('book.toml') }}
restore-keys: |
${{ runner.os }}-rustviz-tutorial-${{ env.RUST_NIGHTLY }}-
- name: Install mdBook 0.5+
run: |
if ! command -v mdbook >/dev/null || ! mdbook --version | grep -q ' v0.5'; then
cargo install mdbook --version "^0.5" --locked
fi
mdbook --version
- name: Clone and install rustviz2-plugin + mdbook-rustviz
run: |
if [ ! -x ~/.cargo/bin/cargo-rv-plugin ] || [ ! -x ~/.cargo/bin/mdbook-rustviz ]; then
git clone --depth 1 https://github.com/${PLUGIN_REPO} ../plugin-src
cargo install --path ../plugin-src/rustviz2-plugin --locked
cargo install --path ../plugin-src/mdbook-rustviz --locked
fi
# Just confirm the binaries are on PATH. Avoid `--help`:
# mdbook-rustviz's main returns clap's DisplayHelp via `?`,
# which exits non-zero (clap's error printer emits the help
# text but treats it as an error). The real usage shape
# (`mdbook-rustviz supports html` + stdin protocol) is
# exercised by the `mdbook build` step below.
command -v mdbook-rustviz
command -v cargo-rv-plugin
- name: Build the book
env:
# In-process plugin invocation — no Docker needed in CI.
RV_RUNNER: local
run: mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: book
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4