build(deps-dev): apply updates
[poolifier.git] / .github / workflows / publish-package.yml
1 name: Publish 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@v4
14
15 - name: Setup pnpm
16 uses: pnpm/action-setup@v2
17 with:
18 version: 8
19
20 - name: Setup Node.js
21 uses: actions/setup-node@v4
22 with:
23 node-version: '20.x'
24 cache: 'pnpm'
25
26 - name: Install Dependencies
27 run: pnpm install --ignore-scripts --frozen-lockfile
28
29 - name: Tests & Coverage
30 run: |
31 pnpm test
32 pnpm coverage
33
34 - name: Lint
35 run: pnpm lint
36
37 - name: Production Build
38 run: pnpm build:prod
39
40 publish-npm:
41 needs: build
42 runs-on: ubuntu-latest
43
44 steps:
45 - name: Checkout
46 uses: actions/checkout@v4
47
48 - name: Setup pnpm
49 uses: pnpm/action-setup@v2
50 with:
51 version: 8
52
53 - name: Setup Node.js
54 uses: actions/setup-node@v4
55 with:
56 node-version: '20.x'
57 registry-url: https://registry.npmjs.org/
58 cache: 'pnpm'
59
60 - name: Install Dependencies
61 run: pnpm install --ignore-scripts --frozen-lockfile
62
63 - name: Read package.json version
64 id: package-version
65 uses: jaywcjlove/github-action-package@main
66
67 - name: Publish Release
68 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
69 run: pnpm publish --no-git-checks
70 env:
71 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72
73 - name: Publish Pre-Release
74 if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }}
75 run: pnpm publish --no-git-checks --tag next
76 env:
77 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78
79 - name: Publish Beta Release
80 if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
81 run: pnpm publish --no-git-checks --tag beta
82 env:
83 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
84
85 # publish-gpr:
86 # needs: build
87 # runs-on: ubuntu-latest
88 # permissions:
89 # contents: read
90 # packages: write
91
92 # steps:
93 # - name: Checkout
94 # uses: actions/checkout@v4
95
96 # - name: Setup pnpm
97 # uses: pnpm/action-setup@v2
98 # with:
99 # version: 8
100
101 # - name: Setup Node.js
102 # uses: actions/setup-node@v4
103 # with:
104 # node-version: '20.x'
105 # registry-url: https://npm.pkg.github.com
106 # cache: 'pnpm'
107
108 # - name: Install Dependencies
109 # run: pnpm install --ignore-scripts --frozen-lockfile
110
111 # - name: Read package.json version
112 # id: package-version
113 # uses: jaywcjlove/github-action-package@main
114
115 # - name: Publish Release
116 # if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
117 # run: pnpm publish --no-git-checks
118 # env:
119 # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}
120
121 # - name: Publish Pre-Release
122 # if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }}
123 # run: pnpm publish --no-git-checks --tag next
124 # env:
125 # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}
126
127 # - name: Publish Beta Release
128 # if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
129 # run: pnpm publish --no-git-checks --tag beta
130 # env:
131 # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}