-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (78 loc) · 2.61 KB
/
publish.yml
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
name: Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-22.04
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
- id: setup-rust
name: Setup Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
# Caching for Cargo
- id: cache-cargo
name: Cache Cargo
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
# Run stepper to verify that tutorial code works, and to generate diffs.
- id: run-stepper
name: Run stepper
run: cargo run --bin stepper -- --debug
- id: setup-mdbook
name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.34'
- id: install-cargo-binstall
name: Install cargo-binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
# Copy files for hashing in the next step, as `hashFiles` only works inside the workspace, not the home directory.
- id: copy-files-for-hashing
name: Copy files for hashing into workspace
run: |
cp ~/.cargo/.crates.toml .crates.toml.hash
cp ~/.cargo/.crates2.json .crates2.json.hash
# Caching for cargo binaries, mainly for speeding up `install-mdbook-processors`.
- id: cache-cargo-binaries
name: Cache Cargo binaries
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cargo-binaries-${{ hashFiles('.crates.toml.hash', '.crates2.json.hash') }}
restore-keys: ${{ runner.os }}-cargo-binaries-
- id: install-mdbook-preprocessors
name: Install mdBook preprocessors
run: cargo binstall --no-confirm --no-symlinks mdbook-admonish mdbook-external-links
- id: install-mdbook-diff2html-preprocessor
name: Install mdbook-diff2html preprocessors
run: cargo install --path mdbook-diff2html
- id: build
name: Build
run: mdbook build
- id: publish
name: Publish to GitHub pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book