Merge dependabot/npm_and_yarn/examples/typescript/websocket-server-pool/ws-hybrid...
[poolifier.git] / .github / workflows / release-please.yml
CommitLineData
4c7e68aa 1name: Release Please
11caf266
APA
2
3on:
4c7e68aa
JB
4 push:
5 branches:
6 - master
7
8permissions:
9 contents: read
11caf266
APA
10
11jobs:
4c7e68aa
JB
12 release-please:
13 runs-on: ubuntu-latest
3a83d94c 14 if: github.repository == 'poolifier/poolifier'
4c7e68aa
JB
15
16 permissions:
17 contents: write
18 pull-requests: write
19
20 outputs:
21 release_created: ${{ steps.release.outputs.release_created }}
22
23 steps:
24 - uses: googleapis/release-please-action@v4
25 id: release
26 with:
27 token: ${{ secrets.WORKFLOW_TOKEN }}
28 config-file: .github/release-please/config.json
29 manifest-file: .github/release-please/manifest.json
30
31 build-release:
32 needs: release-please
11caf266 33 runs-on: ubuntu-latest
4c7e68aa 34 if: needs.release-please.outputs.release_created
515e5da7 35
11caf266 36 steps:
515e5da7 37 - name: Checkout
b358d1ac 38 uses: actions/checkout@v4
515e5da7 39
4c156521 40 - name: Setup pnpm
c94835b4 41 uses: pnpm/action-setup@v4
4c156521 42
8ea47589 43 - name: Setup Node.js
6c527d3f 44 uses: actions/setup-node@v4
11caf266 45 with:
3d5424d5 46 node-version: 20.x
4c156521 47 cache: 'pnpm'
e0d233a8 48
f1c674cd 49 - name: Install Dependencies
c1a37d98 50 run: pnpm install --ignore-scripts --frozen-lockfile
e0d233a8 51
4b85ba43
JB
52 - name: Tests & Coverage
53 run: |
4c156521
JB
54 pnpm test
55 pnpm coverage
11caf266 56
73db65c0 57 - name: Lint
4c156521 58 run: pnpm lint
73db65c0 59
4b85ba43 60 - name: Production Build
4c156521 61 run: pnpm build:prod
4b85ba43 62
b7bb8586 63 publish-jsr:
4c7e68aa 64 needs: build-release
b7bb8586
JB
65 runs-on: ubuntu-latest
66
67 permissions:
68 contents: read
69 id-token: write
70
71 steps:
72 - name: Checkout
73 uses: actions/checkout@v4
74
b7bb8586
JB
75 - name: Setup Node.js
76 uses: actions/setup-node@v4
77 with:
3d5424d5 78 node-version: 20.x
b7bb8586
JB
79
80 - name: Read package.json version
81 id: package-version
82 uses: jaywcjlove/github-action-package@main
83
84 - name: Publish Release
85 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
ad60686d 86 run: npx jsr publish --allow-dirty
b7bb8586 87
cf523f68 88 publish-npm:
4c7e68aa 89 needs: build-release
90bd5e47 90 runs-on: ubuntu-latest
91
92 steps:
93 - name: Checkout
b358d1ac 94 uses: actions/checkout@v4
90bd5e47 95
4c156521 96 - name: Setup pnpm
c94835b4 97 uses: pnpm/action-setup@v4
4c156521 98
8ea47589 99 - name: Setup Node.js
6c527d3f 100 uses: actions/setup-node@v4
11caf266 101 with:
3d5424d5 102 node-version: 20.x
11caf266 103 registry-url: https://registry.npmjs.org/
4c156521 104 cache: 'pnpm'
515e5da7 105
f1c674cd 106 - name: Install Dependencies
c1a37d98 107 run: pnpm install --ignore-scripts --frozen-lockfile
53e40a19 108
5716dd56 109 - name: Read package.json version
5716dd56 110 id: package-version
8fddc4b9 111 uses: jaywcjlove/github-action-package@main
5716dd56 112
5716dd56
S
113 - name: Publish Release
114 if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
a454d573 115 run: pnpm publish --no-git-checks
11caf266 116 env:
74aeaae0 117 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5716dd56 118
17c90274 119 - name: Publish Pre-Release
04805b54 120 if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }}
a454d573 121 run: pnpm publish --no-git-checks --tag next
5716dd56 122 env:
74aeaae0 123 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17c90274 124
8ea47589
JB
125 - name: Publish Beta Release
126 if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
127 run: pnpm publish --no-git-checks --tag beta
128 env:
129 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3a83d94c
JB
130
131 publish-documentation:
3a83d94c 132 needs: [publish-npm, publish-jsr]
147c01ea
JB
133 runs-on: ubuntu-latest
134
135 steps:
136 - name: Checkout
137 uses: actions/checkout@v4
138
139 - name: Setup pnpm
140 uses: pnpm/action-setup@v4
141
142 - name: Setup Node.js
143 uses: actions/setup-node@v4
144 with:
145 node-version: 20.x
146 cache: 'pnpm'
147
148 - name: Generate documentation
149 run: |
150 pnpm install --ignore-scripts --frozen-lockfile
151 pnpm typedoc
152
153 - name: Commit files
b65b3e1b 154 if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'
147c01ea 155 env:
b65b3e1b 156 COMMIT_MESSAGE: 'docs: publish documentation'
147c01ea
JB
157 COMMIT_AUTHOR: Documentation Bot
158 COMMIT_EMAIL: documentation-bot@users.noreply.github.com
159 run: |
160 git config --local user.name "${{ env.COMMIT_AUTHOR }}"
161 git config --local user.email "${{ env.COMMIT_EMAIL }}"
162 git pull
163 git add ./docs
164 git commit -a -m "${{ env.COMMIT_MESSAGE }}"
165
166 - name: Push changes
b65b3e1b 167 if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'
147c01ea
JB
168 uses: CasperWA/push-protected@v2
169 with:
170 token: ${{ secrets.GH_TOKEN_PROTECTED }}
171 branch: ${{ github.event.repository.default_branch }}