You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/blog/2025-01-09-how-adminforth-manages-version/index.md
+85-3Lines changed: 85 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,18 +81,34 @@ In `package.json` add:
81
81
//diff-add
82
82
"release": {
83
83
//diff-add
84
-
"branches": [main", "next"]
84
+
"branches": [main", "next"],
85
+
//diff-add
86
+
"plugins": [
87
+
//diff-add
88
+
"@semantic-release/commit-analyzer",
89
+
//diff-add
90
+
"@semantic-release/release-notes-generator",
91
+
//diff-add
92
+
"@semantic-release/npm",
93
+
//diff-add
94
+
"@semantic-release/github"
95
+
//diff-add
96
+
],
85
97
//diff-add
86
98
}
87
99
}
88
100
```
89
101
90
102
Make sure name in package.json has your organisation name like mine `@devforth/` and you have access to publish packages to npmjs.com.
91
103
104
+
105
+
Also install `semantic-release`:
106
+
92
107
```
93
-
npm install --save-dev semantic-release
108
+
npm i -D semantic-release
94
109
```
95
110
111
+
96
112
## Connecting to CI
97
113
98
114
We will use Woodpecker CI for this example. Woodpecker is a free and open-source CI/CD tool that you can install to your own server / VPS and will not need to pay only for server. No limits on pipelines, users, repositories, etc. If you want to try it, we have [Woodpecker installation guide](https://devforth.io/blog/step-by-step-guide-to-modern-secure-ci-setup/)
@@ -238,4 +254,70 @@ git merge next
238
254
git push
239
255
```
240
256
241
-
This will trigger release `v1.2.0` because we merged `next` to `main` and it was a feature release.
257
+
This will trigger release `v1.2.0` because we merged `next` to `main` and it was a feature release.
258
+
259
+
260
+
## Slack notifications
261
+
262
+
So now we have automatic releases with release notes on GitHub.
263
+
For our internal team we use Slack and we want to get notifications about releases there.
264
+
265
+
```
266
+
npm i -D semantic-release-slack-bot
267
+
```
268
+
269
+
Into "release" section of `package.json` add slack plugin:
270
+
271
+
```
272
+
"plugins": [
273
+
"@semantic-release/commit-analyzer",
274
+
"@semantic-release/release-notes-generator",
275
+
"@semantic-release/npm",
276
+
"@semantic-release/github",
277
+
//diff-add
278
+
[
279
+
//diff-add
280
+
"semantic-release-slack-bot",
281
+
//diff-add
282
+
{
283
+
//diff-add
284
+
"notifyOnSuccess": true,
285
+
//diff-add
286
+
"notifyOnFail": true,
287
+
//diff-add
288
+
"slackIcon": ":package:",
289
+
//diff-add
290
+
"onSuccessTemplate": {
291
+
//diff-add
292
+
"text": "$npm_package_version has been released!"
293
+
//diff-add
294
+
},
295
+
//diff-add
296
+
"markdownReleaseNotes": true
297
+
}
298
+
]
299
+
],
300
+
```
301
+
302
+
303
+
Also create channel in Slack, click on channel name, "Integrations" -> "Add an App" -> "Incoming Webhooks" -> "Add to Slack" -> "Add Incoming Webhook to Workspace" -> "Add to Slack" -> "Copy Webhook URL"
304
+
305
+
Add it to Woodpecker as secret `SLACK_WEBHOOK` environment variable.
306
+
307
+
Also add this secterd to `.woodpecker.yml`:
308
+
309
+
```
310
+
secrets:
311
+
- GITHUB_TOKEN
312
+
- NPM_TOKEN
313
+
//diff-add
314
+
- SLACK_WEBHOOK
315
+
```
316
+
317
+
318
+
This will send notifications to Slack channel about succesfull releases when `npm run build` is done without errors.
319
+
However if you have errors in build, or have unit tests in the flow, you will not get notifications about failed releases, because `npx semantic-release` will not be executed.
320
+
321
+
To fix it we will add another slack notification plugin, moreover we will use dedicated `adminforth-developers` channel for it.
0 commit comments