build: fix publishing on JSR, take 2
[poolifier.git] / .github / workflows / publish-package.yml
CommitLineData
b7bb8586 1name: Publish package
11caf266
APA
2
3on:
4 release:
5 types: [created]
6
7jobs:
8 build:
9 runs-on: ubuntu-latest
515e5da7 10
11caf266 11 steps:
515e5da7 12 - name: Checkout
b358d1ac 13 uses: actions/checkout@v4
515e5da7 14
4c156521 15 - name: Setup pnpm
2ca706c4 16 uses: pnpm/action-setup@v3
4c156521
JB
17 with:
18 version: 8
19
8ea47589 20 - name: Setup Node.js
6c527d3f 21 uses: actions/setup-node@v4
11caf266 22 with:
277c49bf 23 node-version: '20.x'
4c156521 24 cache: 'pnpm'
e0d233a8 25
f1c674cd 26 - name: Install Dependencies
c1a37d98 27 run: pnpm install --ignore-scripts --frozen-lockfile
e0d233a8 28
4b85ba43
JB
29 - name: Tests & Coverage
30 run: |
4c156521
JB
31 pnpm test
32 pnpm coverage
11caf266 33
73db65c0 34 - name: Lint
4c156521 35 run: pnpm lint
73db65c0 36
4b85ba43 37 - name: Production Build
4c156521 38 run: pnpm build:prod
4b85ba43 39
b7bb8586
JB
40 publish-jsr:
41 needs: build
42 runs-on: ubuntu-latest
43
44 permissions:
45 contents: read
46 id-token: write
47
48 steps:
49 - name: Checkout
50 uses: actions/checkout@v4
51
41328ae5
JB
52 - name: Setup pnpm
53 uses: pnpm/action-setup@v3
54 with:
55 version: 8
b7bb8586
JB
56
57 - name: Setup Node.js
58 uses: actions/setup-node@v4
59 with:
60 node-version: '20.x'
41328ae5 61 cache: 'pnpm'
b7bb8586 62
41328ae5
JB
63 - name: Install Dependencies
64 run: pnpm install --ignore-scripts --frozen-lockfile
b7bb8586
JB
65
66 - name: Read package.json version
67 id: package-version
68 uses: jaywcjlove/github-action-package@main
69
41328ae5
JB
70 - name: Production Build
71 run: pnpm build:prod
72
b7bb8586
JB
73 - name: Publish Release
74 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
75 run: npx jsr publish
76
cf523f68 77 publish-npm:
90bd5e47 78 needs: build
79 runs-on: ubuntu-latest
80
81 steps:
82 - name: Checkout
b358d1ac 83 uses: actions/checkout@v4
90bd5e47 84
4c156521 85 - name: Setup pnpm
2ca706c4 86 uses: pnpm/action-setup@v3
4c156521
JB
87 with:
88 version: 8
89
8ea47589 90 - name: Setup Node.js
6c527d3f 91 uses: actions/setup-node@v4
11caf266 92 with:
277c49bf 93 node-version: '20.x'
11caf266 94 registry-url: https://registry.npmjs.org/
4c156521 95 cache: 'pnpm'
515e5da7 96
f1c674cd 97 - name: Install Dependencies
c1a37d98 98 run: pnpm install --ignore-scripts --frozen-lockfile
53e40a19 99
5716dd56 100 - name: Read package.json version
5716dd56 101 id: package-version
8fddc4b9 102 uses: jaywcjlove/github-action-package@main
5716dd56 103
5716dd56
S
104 - name: Publish Release
105 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
a454d573 106 run: pnpm publish --no-git-checks
11caf266 107 env:
74aeaae0 108 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5716dd56 109
17c90274 110 - name: Publish Pre-Release
04805b54 111 if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }}
a454d573 112 run: pnpm publish --no-git-checks --tag next
5716dd56 113 env:
74aeaae0 114 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17c90274 115
8ea47589
JB
116 - name: Publish Beta Release
117 if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
118 run: pnpm publish --no-git-checks --tag beta
119 env:
120 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}