1- name : Book
1+ name : Website
22on :
33 pull_request : {}
44 push :
55 branches :
66 - main
77
8+ concurrency :
9+ group : ${{ github.workflow }}-${{ github.ref }}
10+ cancel-in-progress : false
11+
812jobs :
9- test :
10- name : Test
13+ book- test :
14+ name : Test Book
1115 runs-on : ubuntu-latest
1216 steps :
1317 - uses : actions/checkout@v4
@@ -23,27 +27,20 @@ jobs:
2327 cache-on-failure : true
2428 save-if : ${{ github.ref == 'refs/heads/main' }}
2529
26- - name : Install latest mdbook
27- run : |
28- tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
29- url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
30- mkdir bin
31- curl -sSL $url | tar -xz --directory=bin
32- echo "$(pwd)/bin" >> $GITHUB_PATH
30+ - name : Install Cargo Binary Install
31+ uses : cargo-bins/cargo-binstall@main
32+
33+ - name : Install mdBook
34+ run : cargo binstall -y mdbook
3335
3436 - name : Run tests
3537 run : mdbook test
3638 working-directory : book
3739
38- deploy :
39- name : Deploy
40- needs : test
41- if : github.ref == 'refs/heads/main'
40+ book-build :
41+ name : Build Book
42+ needs : book-test
4243 runs-on : ubuntu-latest
43- permissions :
44- contents : read
45- pages : write
46- id-token : write
4744 steps :
4845 - uses : actions/checkout@v4
4946 with :
@@ -60,16 +57,11 @@ jobs:
6057 cache-on-failure : true
6158 save-if : ${{ github.ref == 'refs/heads/main' }}
6259
63- - name : Install Trunk
64- run : cargo install trunk
60+ - name : Install Cargo Binary Install
61+ uses : cargo-bins/cargo-binstall@main
6562
66- - name : Install latest mdbook
67- run : |
68- tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
69- url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
70- mkdir mdbook
71- curl -sSL $url | tar -xz --directory=./mdbook
72- echo `pwd`/mdbook >> $GITHUB_PATH
63+ - name : Install mdBook and Trunk
64+ run : cargo binstall -y mdbook trunk
7365
7466 - name : Build Book
7567 run : mdbook build
@@ -79,13 +71,41 @@ jobs:
7971 run : cargo run -p mdbook-trunk -- combine
8072 working-directory : book
8173
74+ - name : Upload artifact
75+ uses : actions/upload-artifact@v4
76+ with :
77+ name : book
78+ path : book/dist
79+ retention-days : 1
80+ if-no-files-found : error
81+
82+ deploy :
83+ name : Deploy
84+ needs : book-build
85+ if : github.ref == 'refs/heads/main'
86+ runs-on : ubuntu-latest
87+ permissions :
88+ contents : read
89+ pages : write
90+ id-token : write
91+ steps :
92+ - uses : actions/checkout@v4
93+ with :
94+ fetch-depth : 0
95+
96+ - name : Download artifcats
97+ uses : actions/download-artifact@v4
98+ with :
99+ path : dist
100+ merge-multiple : true
101+
82102 - name : Setup Pages
83103 uses : actions/configure-pages@v4
84104
85105 - name : Upload artifact
86106 uses : actions/upload-pages-artifact@v3
87107 with :
88- path : ' book/ dist'
108+ path : dist
89109
90110 - name : Deploy to GitHub Pages
91111 id : deployment
0 commit comments