Skip to content

Commit 89f6ff4

Browse files
ci: add trunk website workflow
1 parent 8c53202 commit 89f6ff4

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/trunk.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Trunk
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Rust toolchain
21+
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
22+
with:
23+
target: wasm32-unknown-unknown
24+
25+
- name: Install Cargo Binary Install
26+
uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 # v1.18.1
27+
28+
- name: Install mdBook and Trunk
29+
run: cargo binstall --force -y trunk
30+
31+
- name: Install Node.js dependencies
32+
run: npm ci
33+
34+
- name: Build Website
35+
run: trunk build
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
39+
with:
40+
name: website
41+
path: dist
42+
retention-days: 1
43+
if-no-files-found: error
44+
45+
deploy:
46+
name: Deploy
47+
needs: build
48+
if: github.ref == 'refs/heads/main'
49+
runs-on: ubuntu-latest
50+
51+
permissions:
52+
contents: read
53+
pages: write
54+
id-token: write
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Download artifacts
63+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
64+
with:
65+
path: dist
66+
merge-multiple: true
67+
68+
- name: Setup Pages
69+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
70+
71+
- name: Upload artifact
72+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
73+
with:
74+
path: dist
75+
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

0 commit comments

Comments
 (0)