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
name: Build WASM for Playground
on:
# Run on pushes to master that change source code or build configuration
push:
branches:
paths-ignore:
- '**.md'
- 'docs/**'
- 'tests/**'
- 'scripts/build-wasm.py'
- 'benches/**'
- 'examples/**'
# Allow manual trigger
workflow_dispatch:
jobs:
wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Install wasm-opt
run: cargo install wasm-opt
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build WASM module
run: |
chmod +x ./scripts/build-wasm.py
python3 ./scripts/build-wasm.py --optimize --no-typescript
- name: Commit and push if changed
run: |
git pull
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -f docs/assets/wasm/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update WASM files for playground [skip ci]"
git push
fi