-
-
Notifications
You must be signed in to change notification settings - Fork 34
73 lines (62 loc) · 1.69 KB
/
publish.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
70
71
72
73
name: Publish
on:
push:
branches:
- main
jobs:
publish:
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu-latest]
targetplatform: [x64]
runs-on: ${{ matrix.os }}
environment: production
env:
GOOS: js
GOARCH: wasm
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Get dependencies
working-directory: ./cmd
run: |
go vet ./...
- name: Test
run: |
cd cmd
GOOS=js GOARCH=wasm GO111MODULE=on go test -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" -v ./... -coverprofile=coverage.txt -covermode=atomic
- name: Codecov
uses: codecov/codecov-action@v3
with:
directory: ./cmd
file: coverage.txt
flags: unittests
name: codecov-umbrella
- name: Build WASM
run: |
cd cmd
GOOS=js GOARCH=wasm GO111MODULE=on CGO_ENABLED=0 go build -v -a -ldflags="-w -s" -gcflags=-trimpath="$(go env GOPATH)" -asmflags=-trimpath="$(go env GOPATH)" -o ../dist/excelize.wasm main.go
gzip -f --best ../dist/excelize.wasm
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: NPM Build
run: |
npm install
node ./node_modules/.bin/rollup -c
cp LICENSE ./dist
cp README.md ./dist
cp src/package.json ./dist
cp src/index.d.ts ./dist
- name: NPM Publish
uses: JS-DevTools/npm-publish@v2
with:
token: ${{secrets.NPM_TOKEN}}
package: ./dist/package.json