build: fix npm registry publication with pnpm
[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@v3
14
15 - name: Setup Node
16 uses: actions/setup-node@v3
17 with:
18 node-version: '18.x'
19
20 - name: Install
21 run: |
22 corepack enable
23 corepack prepare pnpm@latest --activate
24 pnpm install
25
26 - name: Tests & Coverage
27 run: |
28 pnpm run test
29 pnpm run coverage
30
31 - name: Lint
32 run: pnpm run lint
33
34 - name: Production Build
35 run: pnpm run build:prod
36
37 publish:
38 needs: build
39 runs-on: ubuntu-latest
40
41 steps:
42 - name: Checkout
43 uses: actions/checkout@v3
44
45 - name: Setup Node
46 uses: actions/setup-node@v3
47 with:
48 node-version: '18.x'
49 registry-url: https://registry.npmjs.org/
50
51 - name: Read package.json version
52 id: package-version
53 uses: jaywcjlove/github-action-package@main
54
55 - name: Install
56 run: |
57 corepack enable
58 corepack prepare pnpm@latest --activate
59 pnpm install
60
61 - name: Publish Release
62 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
63 run: pnpm publish
64 env:
65 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66
67 - name: Publish Pre-Release
68 if: ${{ contains(steps.package-version.outputs.version, '-') == true }}
69 run: pnpm publish --tag next
70 env:
71 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72
73 # - name: Publish Beta Release
74 # if: ${{ contains(steps.package-version.outputs.version, 'beta') == true }}
75 # run: pnpm publish --tag beta
76 # env:
77 # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}