-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (110 loc) · 4.37 KB
/
book.yml
File metadata and controls
137 lines (110 loc) · 4.37 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Book
on:
workflow_call:
inputs:
combine:
description: Combine book outputs.
type: boolean
required: false
default: true
clean-options:
description: Options for `cargo clean`, only executed when options are specified.
type: string
required: false
default: ''
build-options:
description: Options for `cargo build`, only executed when options are specified.
type: string
required: false
default: ''
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
with:
target: wasm32-unknown-unknown
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@4852a15cf01e4f33958ce547326406fe78f27c38 # v1.19.0
- name: Install mdBook
run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk
- name: Clean dependencies
if: ${{ inputs.clean-options != '' }}
run: cargo clean ${{ inputs.clean-options}}
- name: Build dependencies
if: ${{ inputs.build-options != '' }}
run: cargo build ${{ inputs.build-options }}
- name: Run tests
run: mdbook test -L ../target/debug/deps
working-directory: book
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
with:
target: wasm32-unknown-unknown
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@4852a15cf01e4f33958ce547326406fe78f27c38 # v1.19.0
- name: Install mdBook and Trunk
run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk trunk
- name: Install Node.js dependencies
run: npm ci
- name: Build Book
run: mdbook build
working-directory: book
- name: Combine Book Outputs
if: ${{ inputs.combine }}
run: mdbook-trunk combine
working-directory: book
- name: Copy Book Output
if: ${{ inputs.combine == false }}
run: rm -rf dist && cp -r book dist
working-directory: book
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: book
path: book/dist
retention-days: 1
if-no-files-found: error
deploy:
name: Deploy
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
merge-multiple: true
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0