build: fix publishing on JSR
[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
52 # - name: Setup pnpm
53 # uses: pnpm/action-setup@v3
54 # with:
55 # version: 8
56
57 - name: Setup Node.js
58 uses: actions/setup-node@v4
59 with:
60 node-version: '20.x'
d51af9f9 61 # cache: 'pnpm'
b7bb8586
JB
62
63 # - name: Install Dependencies
64 # run: pnpm install --ignore-scripts --frozen-lockfile
65
66 - name: Read package.json version
67 id: package-version
68 uses: jaywcjlove/github-action-package@main
69
70 - name: Publish Release
71 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
72 run: npx jsr publish
73
cf523f68 74 publish-npm:
90bd5e47 75 needs: build
76 runs-on: ubuntu-latest
77
78 steps:
79 - name: Checkout
b358d1ac 80 uses: actions/checkout@v4
90bd5e47 81
4c156521 82 - name: Setup pnpm
2ca706c4 83 uses: pnpm/action-setup@v3
4c156521
JB
84 with:
85 version: 8
86
8ea47589 87 - name: Setup Node.js
6c527d3f 88 uses: actions/setup-node@v4
11caf266 89 with:
277c49bf 90 node-version: '20.x'
11caf266 91 registry-url: https://registry.npmjs.org/
4c156521 92 cache: 'pnpm'
515e5da7 93
f1c674cd 94 - name: Install Dependencies
c1a37d98 95 run: pnpm install --ignore-scripts --frozen-lockfile
53e40a19 96
5716dd56 97 - name: Read package.json version
5716dd56 98 id: package-version
8fddc4b9 99 uses: jaywcjlove/github-action-package@main
5716dd56 100
5716dd56
S
101 - name: Publish Release
102 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
a454d573 103 run: pnpm publish --no-git-checks
11caf266 104 env:
74aeaae0 105 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5716dd56 106
17c90274 107 - name: Publish Pre-Release
04805b54 108 if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }}
a454d573 109 run: pnpm publish --no-git-checks --tag next
5716dd56 110 env:
74aeaae0 111 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17c90274 112
8ea47589
JB
113 - name: Publish Beta Release
114 if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
115 run: pnpm publish --no-git-checks --tag beta
116 env:
117 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}