Skip to content

Commit 2a63725

Browse files
authored
preparing to upload to npm (#13)
* preparing to upload to npm * restructure the lib.rs so wasm-pack can compile on it * release compile opt
1 parent bbf31a7 commit 2a63725

File tree

12 files changed

+326
-303
lines changed

12 files changed

+326
-303
lines changed

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy WASM to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v4
15+
16+
- uses: dtolnay/rust-toolchain@stable
17+
with:
18+
targets: wasm32-unknown-unknown
19+
- name: install wasm-bindgen-cli
20+
run: |
21+
cargo install wasm-bindgen-cli
22+
23+
- name: Install wasm-pack
24+
run: |
25+
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh
26+
27+
- name: Build WASM
28+
run: wasm-pack build --target web
29+
30+
- name: Deploy to gh-pages
31+
uses: peaceiris/actions-gh-pages@v6
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_branch: gh-pages
35+
publish_dir: ./pkg
36+
keep_files: false
37+
force_orphan: true

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
4040
- name: Prepare package
4141
run: |
42-
wasm-bindgen --no-typescript --out-name bevy_game --out-dir wasm --target web target/wasm32-unknown-unknown/release/${{ env.binary }}.wasm
42+
wasm-bindgen --no-typescript --out-name vizmat --out-dir wasm --target web target/wasm32-unknown-unknown/release/${{ env.binary }}.wasm
4343
cp -r assets wasm/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
4444
4545
- name: Package as a zip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
/dist
3+
/pkg

0 commit comments

Comments
 (0)