File tree 3 files changed +90
-2
lines changed
3 files changed +90
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : NPM Release
2
+ on :
3
+ push :
4
+ tags :
5
+ - " v*"
6
+
7
+ jobs :
8
+ npm :
9
+ name : NPM Build & Publish
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Setup | Checkout
13
+ uses : actions/checkout@v3
14
+ with :
15
+ fetch-depth : 0
16
+
17
+ # Cache files between builds
18
+ - name : Setup | Cache Cargo
19
+
20
+ with :
21
+ path : |
22
+ ~/.cargo/registry
23
+ ~/.cargo/git
24
+ key : npm-build-cargo-${{ hashFiles('**/Cargo.lock') }}
25
+
26
+ - name : Setup | Rust
27
+ uses :
actions-rs/[email protected]
28
+ with :
29
+ toolchain : nightly
30
+ override : true
31
+ profile : minimal
32
+ target : x86_64-unknown-linux-gnu
33
+
34
+ - uses : actions/setup-node@v3
35
+ with :
36
+ node-version : " 16.x"
37
+ registry-url : " https://registry.npmjs.org"
38
+
39
+ - name : Install wasm-pack & wasm-opt
40
+ run : |
41
+ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
42
+ sudo apt-get install binaryen
43
+
44
+ - name : Publish NPM
45
+ run : |
46
+ echo $(git describe --abbrev=0 --tags | sed "s/^v//")
47
+ make wasm:publish
48
+ env :
49
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change @@ -143,3 +143,39 @@ jobs:
143
143
144
144
- name : Image digest
145
145
run : echo ${{ steps.docker_build.outputs.digest }}
146
+ npm :
147
+ runs-on : ubuntu-latest
148
+ needs : github_release
149
+ steps :
150
+ - name : Setup | Checkout
151
+
152
+
153
+ # Cache files between builds
154
+ - name : Setup | Cache Cargo
155
+
156
+ with :
157
+ path : |
158
+ ~/.cargo/registry
159
+ ~/.cargo/git
160
+ key : npm-build-cargo-${{ hashFiles('**/Cargo.lock') }}
161
+
162
+ - name : Setup | Rust
163
+ uses :
actions-rs/[email protected]
164
+ with :
165
+ toolchain : stable
166
+ override : true
167
+ profile : minimal
168
+ target : x86_64-unknown-linux-gnu
169
+
170
+ - uses : actions/setup-node@v3
171
+ with :
172
+ node-version : " 16.x"
173
+ registry-url : " https://registry.npmjs.org"
174
+
175
+ - name : Setup wasm-pack
176
+ run : curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
177
+
178
+ - name : Publish NPM
179
+ run : make wasm:publish
180
+ env :
181
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 1
1
WORKDIR =$(shell pwd)
2
- LAST_TAG_VERSION =$(shell git describe --abbrev=0 --tags | sed -e "s/v//")
2
+ LAST_TAG_VERSION =$(shell git describe --abbrev=0 --tags | sed "s/^ v//")
3
3
4
4
bench :
5
5
rustup run nightly cargo bench --features bench
@@ -19,12 +19,15 @@ test\:bench:
19
19
tests/bench.sh
20
20
test\ :lint-json:
21
21
tests/test_lint_json.sh
22
+ install :
23
+ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
24
+ brew install binaryen
22
25
wasm :
23
26
wasm-pack build --release --scope huacnlee -d $(WORKDIR ) /pkg autocorrect
24
27
wasm-opt -Os -o pkg/autocorrect_bg.wasm pkg/autocorrect_bg.wasm
25
28
wasm\ :publish:
26
29
make wasm
27
30
@echo " \n\nWill release version: $( LAST_TAG_VERSION) \n\n"
28
- cd pkg && npm version $(LAST_TAG_VERSION ) && npm publish
31
+ cd pkg && yarn publish --new- version $(LAST_TAG_VERSION )
29
32
crate\ :publish:
30
33
cargo release --manifest-path autocorrect/Cargo.toml --config autocorrect/release.toml
You can’t perform that action at this time.
0 commit comments