File tree 5 files changed +61
-18
lines changed
5 files changed +61
-18
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ name: Publish Web Demo
3
3
on :
4
4
push :
5
5
tags :
6
- - web-demo
7
6
- ' v*'
8
7
jobs :
9
8
publish-web-demo :
@@ -34,13 +33,29 @@ jobs:
34
33
with :
35
34
version : ' 0.2.81'
36
35
37
- - name : Build WASM Dist 🔨
38
- run : just build-release-web /punchy/demo
36
+ - name : Build WASM Release 🔨
37
+ run : just build-release-web
39
38
40
39
- name : Deploy 🚀
41
40
42
41
with :
43
42
branch : gh-pages
44
- folder : target/wasm-dist
45
- target-folder : demo
46
- ssh-key : ${{ secrets.MASTER_GH_PAGES_DEPLOY_KEY }}
43
+ folder : web-target/wasm-release
44
+ target-folder : player/${{ github.ref_name }}
45
+ ssh-key : ${{ secrets.MASTER_GH_PAGES_DEPLOY_KEY }}
46
+
47
+ - name : Symlink Latest Build
48
+ run : |
49
+ mkdir latest-symlink-dir
50
+ ln -s ./${{ github.ref_name }} latest
51
+ mv latest latest-symlink-dir
52
+
53
+ - name : Deploy Symlinked Latest Build 🚀
54
+
55
+ with :
56
+ branch : gh-pages
57
+ folder : latest-symlink-dir
58
+ clean : false
59
+ target-folder : player
60
+ ssh-key : ${{ secrets.MASTER_GH_PAGES_DEPLOY_KEY }}
61
+
Original file line number Diff line number Diff line change 1
1
/target
2
+ /web-target
2
3
.cargo
Original file line number Diff line number Diff line change @@ -13,22 +13,19 @@ build:
13
13
build-release :
14
14
cargo build --release
15
15
16
- build-web :
17
- cargo build --target wasm32 -unknown-unknown
18
- wasm-bindgen --out-dir target/ wasm --target web target/ wasm32 -unknown-unknown/ debug/ punchy.wasm
19
- cat wasm_resources/ index.html | sed " s/\$ BASEPATH//g" > target/ wasm/ index.html
20
- mkdir -p target/ wasm
21
- cp -r assets target/ wasm/
16
+ build-web basepath = ' ':
17
+ ./ scripts/ build-web.sh
22
18
23
19
build-release-web basepath = ' ':
24
- cargo build --target wasm32 -unknown-unknown --release
25
- wasm-bindgen --out-dir target/ wasm-dist --no-typescript --target web target/ wasm32 -unknown-unknown/ release/ punchy.wasm
26
- cat wasm_resources/ index.html | sed " s/\$ BASEPATH/$(printf {{ basepath}} | sed 's/\/ /\\\/ /g')/g" > target/ wasm-dist/ index.html
27
- cp -r assets target/ wasm-dist/
20
+ ./ scripts/ build-web.sh release
28
21
29
22
run * args :
30
23
cargo run -- {{ args}}
31
24
32
25
run-web port = ' 4000' host = ' 127.0.0.1': build-web
33
26
@ echo " Debug link: http://{{ host}} :{{ port}} ?RUST_LOG=debug"
34
- basic-http-server -a ' {{ host}} :{{ port}} ' -x target/ wasm
27
+ basic-http-server -a ' {{ host}} :{{ port}} ' -x web-target/ wasm-debug
28
+
29
+ run-release-web port = ' 4000' host = ' 127.0.0.1': build-release-web
30
+ @ echo " Debug link: http://{{ host}} :{{ port}} ?RUST_LOG=debug"
31
+ basic-http-server -a ' {{ host}} :{{ port}} ' -x web-target/ wasm-release
Original file line number Diff line number Diff line change
1
+ #! /bin/env bash
2
+
3
+ #
4
+ # This script is usually run by the justfile
5
+ #
6
+
7
+ is_release=" $1 "
8
+ target=wasm32-unknown-unknown
9
+ target_dir=" web-target"
10
+
11
+ release_arg=" "
12
+ build_kind=" debug"
13
+ dist_dir=" $target_dir /wasm-debug"
14
+
15
+ if [ " $is_release " == " release" ]; then
16
+ release_arg=" --release"
17
+ build_kind=" release"
18
+ dist_dir=" $target_dir /wasm-release"
19
+ fi
20
+
21
+ export CARGO_TARGET_DIR=$target_dir
22
+
23
+ set -x
24
+
25
+ cargo build --target $target $release_arg
26
+ rm -rf $dist_dir
27
+ mkdir -p $dist_dir
28
+ wasm-bindgen --out-dir $dist_dir --target web --no-typescript $target_dir /$target /$build_kind /punchy.wasm
29
+ cp wasm_resources/index.html $dist_dir /index.html
30
+ cp -r assets $dist_dir
Original file line number Diff line number Diff line change 136
136
} ) ( ) ;
137
137
</ script >
138
138
< script type ="module ">
139
- import init from "$BASEPATH /punchy.js" ;
139
+ import init from ". /punchy.js" ;
140
140
init ( ) ;
141
141
</ script >
142
142
</ body >
You can’t perform that action at this time.
0 commit comments