Migrate the code to node.js LTS version 16.x.x (#492)
[poolifier.git] / .github / workflows / npmpublish.yml
1 name: Node.js Package
2
3 on:
4 release:
5 types: [created]
6
7 jobs:
8 build:
9 runs-on: ubuntu-latest
10
11 steps:
12 - name: Checkout
13 uses: actions/checkout@v2
14
15 - name: Setup Node
16 uses: actions/setup-node@v2
17 with:
18 node-version: 16
19
20 - name: Install
21 run: npm ci
22
23 - name: Production Build
24 run: npm run build:prod
25
26 - name: Lint
27 run: npm run lint
28
29 - name: Production Tests & Coverage
30 run: |
31 npm run test:prod
32 npm run coverage
33 env:
34 CI: true
35
36 publish-npm:
37 needs: build
38 runs-on: ubuntu-latest
39
40 steps:
41 - name: Checkout
42 uses: actions/checkout@v2
43
44 - name: Setup Node
45 uses: actions/setup-node@v2
46 with:
47 node-version: 16
48 registry-url: https://registry.npmjs.org/
49
50 - name: Read package.json version
51 uses: tyankatsu0105/read-package-version-actions@v1
52 id: package-version
53
54 - name: Install
55 run: npm ci
56
57 - name: Publish Release
58 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
59 run: |
60 npm login
61 npm publish
62 env:
63 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
64
65 - name: Publish Beta
66 if: ${{ contains(steps.package-version.outputs.version, 'beta') }}
67 run: npm publish --tag beta
68 env:
69 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}