-
Notifications
You must be signed in to change notification settings - Fork 137
69 lines (60 loc) · 2.03 KB
/
web-demo.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
name: Web Demo Update
on:
push:
branches:
- main
jobs:
release-web:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: install wasm-bindgen
uses: taiki-e/install-action@v2
with:
# If updating, also update in examples/with_winit/Cargo.toml
tool: [email protected]
- name: build (wasm)
run: cargo build -p with_winit --bin with_winit_bin --release --target wasm32-unknown-unknown
- name: package wasm
run: |
mkdir public
wasm-bindgen --target web --out-dir public target/wasm32-unknown-unknown/release/with_winit_bin.wasm --no-typescript
cat << EOF > public/index.html
<html>
<title>Vello Web Demo</title>
<meta content=no-cache http-equiv=Cache-control>
<meta content=-1 http-equiv=Expires>
<script type=module>import initSync from"/vello/with_winit_bin.js";initSync(`/vello/with_winit_bin_bg.wasm`);</script>
<link as=fetch crossorigin href=/vello/with_winit_bin_bg.wasm rel=preload type=application/wasm>
<link crossorigin href=/vello/with_winit_bin.js rel=modulepreload>
</head>
<body>
<style>
body {
margin: 0;
padding: 0;
}
</style>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4