@@ -19,53 +19,34 @@ jobs:
19
19
if : ${{ github.event_name == 'push' }}
20
20
steps :
21
21
- uses : actions/checkout@v2
22
+ - uses : ./.github/actions/setup-rust-wasm
23
+ - name : Yarn install
24
+ working-directory : crates/wasm/js-demo
25
+ run : yarn install
22
26
23
- - name : Install Rust 1.52.1
24
- uses : actions-rs/toolchain@v1
25
- with :
26
- toolchain : 1.52.1
27
- override : true
28
- - uses : Swatinem/rust-cache@v1
29
- with :
30
- sharedKey : ${{ github.ref == 'refs/heads/master' && 'cargo-wasm-release' || 'cargo-wasm-debug' }}
31
-
32
- - name : Install wasm-pack and binaryen
33
- # run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
34
- #
35
- # wasm-opt seems to have a segfault, wasm-pack doesn't let you use a wasm-opt off your $PATH,
36
- # it has to use its own pinned version and is not being updated much at the moment.
37
- # So custom wasm-pack, and binaryen from github releases
27
+ - name : >
28
+ Build WASM pkg
29
+ (${{ github.ref == 'refs/heads/master' && '--release' || '--dev' }})
30
+ working-directory: crates/wasm
38
31
run: |
39
- cd /tmp
40
- mkdir -p $HOME/.local/bin
41
- echo "$HOME/.local/bin" >> $GITHUB_PATH
42
-
43
- VERSION=manual-1
44
- curl -sL -o wasm-pack.tar.gz https://github.com/cormacrelf/wasm-pack/releases/download/$VERSION/wasm-pack-$VERSION-x86_64-unknown-linux-gnu.tar.gz
45
- tar -xzvf wasm-pack.tar.gz
46
- cp wasm-pack $HOME/.local/bin/
32
+ ./scripts/npm-pkg-config.sh \
33
+ ${{ github.ref != 'refs/heads/master' && '--dev' || '' }} \
34
+ --targets browser \
35
+ --set-name @citeproc-rs/wasm \
36
+ --dest ./pkg \
37
+ --features console,dot
47
38
48
- VERSION=version_101
49
- curl -sL -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/$VERSION/binaryen-$VERSION-x86_64-linux.tar.gz
50
- tar -xzvf binaryen.tar.gz
51
- cp binaryen-$VERSION/bin/* $HOME/.local/bin/
39
+ - run : yarn build
40
+ working-directory : crates/wasm/js-demo
52
41
53
- - name : Yarn install
54
- run : cd crates/wasm/js-demo && yarn
55
- - name : Yarn build (dev)
56
- if : ${{ github.ref != 'refs/heads/master' }}
57
- run : cd crates/wasm/js-demo && yarn build -d
58
- - name : Yarn build (prod)
59
- if : ${{ github.ref == 'refs/heads/master' }}
60
- run : cd crates/wasm/js-demo && yarn build -p
61
42
- name : Deploy
62
43
if : ${{ github.ref == 'refs/heads/master' }}
63
44
uses : peaceiris/actions-gh-pages@v2
64
45
env :
65
46
ACTIONS_DEPLOY_KEY : ${{ secrets.ACTIONS_DEPLOY_KEY }}
66
47
PERSONAL_TOKEN : ${{ secrets.PERSONAL_TOKEN }}
67
48
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
- PUBLISH_DIR : ./crates/wasm/js-demo/dist
49
+ PUBLISH_DIR : ./crates/wasm/js-demo/build
69
50
EXTERNAL_REPOSITORY : cormacrelf/citeproc-wasm-demo
70
51
PUBLISH_BRANCH : gh-pages
71
52
92
73
93
74
if $IS_TAGGED_RELEASE; then
94
75
TAG=${GITHUB_REF#refs/tags/wasm-}
95
- IFS='-' read -ra PLAIN_VERSION POST_HYPHEN <<< "$TAG"
96
- if ! [ -z "$POST_HYPHEN" ]; then
76
+ IFS='-' read -ra _ POST_HYPHEN <<< "$TAG"
77
+ if [ -n "$POST_HYPHEN" ]; then
97
78
# i.e. there was a -alpha.1 appended, use the `next` dist tag
98
79
set-output npm_dist_tag next
99
80
else
@@ -111,31 +92,7 @@ jobs:
111
92
dist tag ${{ steps.version.outputs.npm_dist_tag }}
112
93
run: echo
113
94
114
- - name : Install Rust 1.52.1
115
- uses : actions-rs/toolchain@v1
116
- with :
117
- toolchain : 1.52.1
118
- override : true
119
- - uses : Swatinem/rust-cache@v1
120
- with :
121
- sharedKey : cargo-wasm-release
122
-
123
- - name : Install wasm-pack and binaryen
124
- # run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
125
- run : |
126
- cd /tmp
127
- mkdir -p $HOME/.local/bin
128
- echo "$HOME/.local/bin" >> $GITHUB_PATH
129
-
130
- VERSION=manual-1
131
- curl -sL -o wasm-pack.tar.gz https://github.com/cormacrelf/wasm-pack/releases/download/$VERSION/wasm-pack-$VERSION-x86_64-unknown-linux-gnu.tar.gz
132
- tar -xzvf wasm-pack.tar.gz
133
- cp wasm-pack $HOME/.local/bin/
134
-
135
- VERSION=version_101
136
- curl -sL -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/$VERSION/binaryen-$VERSION-x86_64-linux.tar.gz
137
- tar -xzvf binaryen.tar.gz
138
- cp binaryen-$VERSION/bin/* $HOME/.local/bin/
95
+ - uses : ./.github/actions/setup-rust-wasm
139
96
140
97
- name : Build for all targets
141
98
working-directory : crates/wasm
@@ -151,7 +108,7 @@ jobs:
151
108
- name : Publish @citeproc-rs/wasm to NPM
152
109
working-directory : crates/wasm
153
110
run : >
154
- npm publish dist --access public
111
+ npm publish ./ dist --access public
155
112
--tag ${{ steps.version.outputs.npm_dist_tag }}
156
113
${{ steps.version.outputs.npm_dry_run == 'true' && '--dry-run' || '' }}
157
114
0 commit comments