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