-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
79 lines (66 loc) · 2.1 KB
/
publish-examples.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
name: Publish Examples
on:
push:
branches: [master]
jobs:
publish:
runs-on: ubuntu-latest
env:
# leave empty for /
PUBLIC_URL_PREFIX: ""
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- uses: jetli/trunk-action@v0.1.0
with:
# Optional version of trunk to install(eg. 'v0.8.1', 'latest')
version: 'latest'
- uses: jetli/wasm-bindgen-action@v0.1.0
with:
# Optional version of wasm-bindgen to install(eg. '0.2.68', 'latest')
version: 'latest'
- name: Build examples
run: |
output="$(pwd)/dist"
mkdir "$output"
for path in examples/*; do
if [[ ! -d $path ]]; then
continue
fi
example=$(basename "$path")
# multi_thread doesn't work yet. See <https://github.com/thedodd/trunk/issues/40>.
if [[ "$example" == "multi_thread" ]]; then
continue
fi
# web_worker_fib does not compile with trunk. See <https://github.com/thedodd/trunk/issues/46>.
if [[ "$example" == "web_worker_fib" ]]; then
continue
fi
echo "building: $example"
(
cd "$path"
dist_dir="$output/$example"
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL_PREFIX/$example"
)
done
- name: Deploy to Firebase
uses: siku2/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseToken: "${{ secrets.FIREBASE_TOKEN }}"
channelId: live
targets: examples