File tree Expand file tree Collapse file tree 2 files changed +69
-12
lines changed
Expand file tree Collapse file tree 2 files changed +69
-12
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- (cd && \
4- curl -LO https://github.com/ankitects/mdbook-linkcheck/releases/download/anki-2022-11-17/mdbook.tar.zst && \
5- tar xaf mdbook.tar.zst)
6- export PATH=" $HOME :$PATH "
7- if [ " $CHECK " = " " ]; then
8- rm $HOME /mdbook-linkcheck
9- fi
3+ # Version configuration
4+ MDBOOK_VERSION=" 0.4.51"
5+ MDBOOK_LINKCHECK_COMMIT=" 3222e857f22a5b41596070848203d160a4d78fd9"
6+ MDBOOK_TOC_VERSION=" 0.14.2"
7+
8+ # mdbook needs to be able to find things like mdbook-toc
9+ export PATH=" $HOME /.cargo/bin:$PATH "
10+
11+ install_if_needed () {
12+ local binary=$1
13+ local install_cmd=$2
14+
15+ if [ " $GITHUB_ACTIONS " = " true" ]; then
16+ # avoid recompiling if cached
17+ if ! command -v $binary & > /dev/null; then
18+ eval $install_cmd
19+ fi
20+ else
21+ eval $install_cmd
22+ fi
23+ }
24+
25+ # Install required binaries
26+ install_if_needed " mdbook" " cargo install mdbook --version $MDBOOK_VERSION "
27+ install_if_needed " mdbook-toc" " cargo install mdbook-toc --version $MDBOOK_TOC_VERSION "
28+ install_if_needed " mdbook-linkcheck" " cargo install --git https://github.com/ankitects/mdbook-linkcheck --rev $MDBOOK_LINKCHECK_COMMIT mdbook-linkcheck"
29+
30+ # Avoid checking links in deploy mode
31+ if [ " $CHECK " == " " ]; then
32+ mv $HOME /.cargo/bin/mdbook-linkcheck linkcheck-tmp
33+ fi
34+
35+ mdbook --version
1036mdbook build
37+
38+ if [ " $CHECK " == " " ]; then
39+ # restore linkcheck so it gets stored in the cache
40+ mv linkcheck-tmp $HOME /.cargo/bin/mdbook-linkcheck
41+ fi
Original file line number Diff line number Diff line change 1111
1212jobs :
1313 deploy :
14- runs-on : ubuntu-22 .04
14+ runs-on : ubuntu-24 .04
1515 steps :
16- - uses : actions/checkout@v3
16+ - uses : actions/checkout@v4
17+
18+ - name : Install Rust
19+ uses : dtolnay/rust-toolchain@stable
20+ with :
21+ components : rustfmt
22+
23+ - name : Cache binaries
24+ uses : actions/cache@v4
25+ with :
26+ path : ~/.cargo/bin
27+ key : ${{ runner.os }}-bin-${{ hashFiles('.github/workflows/build.sh') }}
28+ restore-keys : |
29+ ${{ runner.os }}-bin-
1730
1831 - name : Build
1932 run : .github/workflows/build.sh
2033
2134 - name : Deploy
22- uses : peaceiris/actions-gh-pages@v3
35+ uses : peaceiris/actions-gh-pages@v4
2336 with :
2437 github_token : ${{ secrets.GITHUB_TOKEN }}
2538 publish_dir : ./book/html
2639 cname : ${{ env.cname }}
2740
2841 check :
29- runs-on : ubuntu-22 .04
42+ runs-on : ubuntu-24 .04
3043 steps :
31- - uses : actions/checkout@v3
44+ - uses : actions/checkout@v4
45+
46+ - name : Install Rust
47+ uses : dtolnay/rust-toolchain@stable
48+ with :
49+ components : rustfmt
50+
51+ - name : Cache binaries
52+ uses : actions/cache@v4
53+ with :
54+ path : ~/.cargo/bin
55+ key : ${{ runner.os }}-bin-${{ hashFiles('.github/workflows/build.sh') }}
56+ restore-keys : |
57+ ${{ runner.os }}-bin-
3258
3359 - name : Build
3460 run : CHECK=1 .github/workflows/build.sh
You can’t perform that action at this time.
0 commit comments