-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (92 loc) · 3.25 KB
/
docs.yml
File metadata and controls
108 lines (92 loc) · 3.25 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
name: Docs
on:
push:
branches: [main]
paths:
- "docs-site/**"
- "crates/paperjam-wasm/**"
- ".github/workflows/docs.yml"
pull_request:
branches: [main]
paths:
- "docs-site/**"
- "crates/paperjam-wasm/**"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Rust cache
uses: Swatinem/rust-cache@v2.9.1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# wasm-pack invokes wasm-opt automatically when it is on PATH.
# Ubuntu's apt-packaged binaryen (~v108) is too old to validate
# modern rustc output — rustc 1.95+ emits bulk-memory and
# sign-extension instructions by default, which that wasm-opt
# rejects. We install a pinned upstream release, verify its
# SHA256, and cache it across runs.
- name: Cache binaryen
id: cache-binaryen
uses: actions/cache@v5
env:
BINARYEN_VERSION: version_119
with:
path: /usr/local/bin/wasm-opt
key: binaryen-${{ env.BINARYEN_VERSION }}-x86_64-linux
- name: Install binaryen (wasm-opt)
if: steps.cache-binaryen.outputs.cache-hit != 'true'
env:
BINARYEN_VERSION: version_119
BINARYEN_SHA256: 716bcf9f5f36a6f466239fbb09a925eeaf54c46411ccefac979ec649e7c06d2d
run: |
set -euo pipefail
tarball="binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz"
url="https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/${tarball}"
curl -fsSL "$url" -o "/tmp/${tarball}"
echo "${BINARYEN_SHA256} /tmp/${tarball}" | sha256sum --check --strict
tar -xzf "/tmp/${tarball}" -C /tmp
sudo install -m 0755 "/tmp/binaryen-${BINARYEN_VERSION}/bin/wasm-opt" /usr/local/bin/wasm-opt
- name: Verify wasm-opt
run: wasm-opt --version
- name: Build WASM
run: wasm-pack build crates/paperjam-wasm --target web --release --out-dir ../../docs-site/static/wasm
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
cache-dependency-path: docs-site/package-lock.json
- name: Install dependencies
run: cd docs-site && npm ci
- name: Build Docusaurus
run: cd docs-site && npm run build
- name: Upload Pages artifact
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-pages-artifact@v5
with:
path: docs-site/build
deploy:
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5