-
Notifications
You must be signed in to change notification settings - Fork 7
50 lines (42 loc) · 1.24 KB
/
publishToNpm.yaml
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
name: Publish To NPM
on:
release:
types: [published]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 18
registry-url: https://registry.npmjs.org/
# we run with npm install instead of npm ci to make sure the package can run with latest packages
- name: npm install build and test
run: |
npm install
npm run build --if-present
npm run test:coverage
env:
CLIENT_EMAIL: ${{secrets.CLIENT_EMAIL }}
PRIVATE_KEY: ${{secrets.PRIVATE_KEY }}
FOLDER_ID: ${{secrets.FOLDER_ID }}
- name: Upload code coverage
if: env.CODECOV_TOKEN != ''
run: |
npm install codecov@latest -g
mv coverage/coverage-final.json coverage/coverage.json
codecov
- name: Publish to NPM
run: |
if [ "$NPM_TOKEN" != "" ]; then
npm publish
else
echo "Skip Publish. NPM_TOKEN not exists."
exit 1
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}