-
-
Notifications
You must be signed in to change notification settings - Fork 3
115 lines (94 loc) · 3.23 KB
/
website.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Website
on:
pull_request: {}
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
book-test:
name: Test Book
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust toolchain
run: |
rustup toolchain install stable --no-self-update --profile minimal
rustup target add wasm32-unknown-unknown
- name: Set up Rust cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@main
- name: Install mdBook
run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk
- name: Run tests
run: mdbook test
working-directory: book
book-build:
name: Build Book
needs: book-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust toolchain
run: |
rustup toolchain install stable --no-self-update --profile minimal
rustup target add wasm32-unknown-unknown
- name: Set up Rust cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@main
- name: Install mdBook and Trunk
run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk trunk
- name: Install Node.js dependencies
run: npm install
- name: Build Book
run: mdbook build
working-directory: book
- name: Combine Book Outputs
run: mdbook-trunk combine
working-directory: book
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: book
path: book/dist
retention-days: 1
if-no-files-found: error
deploy:
name: Deploy
needs: book-build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4