-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (89 loc) · 3.16 KB
/
publish-tutorial.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
79
80
81
82
83
84
85
86
87
88
89
name: Publish tutorial
on:
push:
branches:
- master
jobs:
publish-tutorial:
runs-on: ubuntu-22.04
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 tutorial stepper application
- id: cache-stepper
name: Cache stepper
uses: actions/cache@v3
with:
path: tutorial/stepper/target
key: ${{ runner.os }}-stepper-${{ hashFiles('tutorial/stepper/Cargo.lock') }}
restore-keys: ${{ runner.os }}-stepper-
# Run stepper to verify that tutorial code works, and to generate diffs.
- id: run-stepper
name: Run stepper
run: |
cd tutorial/stepper
cargo run -- --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-${{ hashFiles('.crates.toml.hash', '.crates2.json.hash') }}
restore-keys: ${{ runner.os }}-cargo-
- id: install-mdbook-preprocessors
name: Install mdBook preprocessors
run: cargo binstall --no-confirm --no-symlinks mdbook-admonish mdbook-external-links
# Caching for tutorial mdbook-diff2html application
- id: cache-mdbook-diff2html
name: Cache mdbook-diff2html
uses: actions/cache@v3
with:
path: tutorial/mdbook-diff2html/target
key: ${{ runner.os }}-mdbook-diff2html-${{ hashFiles('tutorial/mdbook-diff2html/Cargo.lock') }}
restore-keys: ${{ runner.os }}-mdbook-diff2html-
- id: install-mdbook-diff2html-preprocessor
name: Install mdbook-diff2html preprocessors
run: cargo install --path tutorial/mdbook-diff2html
- id: build
name: Build tutorial mdBook
run: |
cd tutorial
mdbook build
- id: deploy
name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tutorial/book