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
+37-19Lines changed: 37 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,18 +84,6 @@ In `package.json` add:
84
84
"branches": [main", "next"],
85
85
//diff-add
86
86
"plugins": [
87
-
//diff-add
88
-
[
89
-
//diff-add
90
-
"@semantic-release/exec",
91
-
//diff-add
92
-
{
93
-
//diff-add
94
-
"prepareCmd": "npm run build"
95
-
//diff-add
96
-
}
97
-
//diff-add
98
-
],
99
87
//diff-add
100
88
"@semantic-release/commit-analyzer",
101
89
//diff-add
@@ -114,13 +102,12 @@ In `package.json` add:
114
102
Make sure name in package.json has your organisation name like mine `@devforth/` and you have access to publish packages to npmjs.com.
115
103
116
104
117
-
Also install `semantic-release` and `@semantic-release/exec`:
105
+
Also install `semantic-release`:
118
106
119
107
```
120
-
npm i -D semantic-release @semantic-release/exec
108
+
npm i -D semantic-release
121
109
```
122
110
123
-
We use `@semantic-release/exec` to run `npm run build` as prepare step for release. Of course you can run build before calling `semantic-release` in CI pipleine, but this approach will allow to nativeley integrate it with `semantic-release` and e.g. show build errors in semantic-release notification plugins.
124
111
125
112
## Connecting to CI
126
113
@@ -145,6 +132,7 @@ steps:
145
132
- /var/run/docker.sock:/var/run/docker.sock
146
133
commands:
147
134
- npm clean-install
135
+
- npm run build
148
136
- npm audit signatures
149
137
- npx semantic-release
150
138
secrets:
@@ -278,15 +266,37 @@ For our internal team we use Slack and we want to get notifications about releas
278
266
npm i -D semantic-release-slack-bot
279
267
```
280
268
281
-
Into "release" section of `package.json` add:
269
+
Into "release" section of `package.json` add slack plugin:
282
270
283
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
284
278
[
285
-
"@semantic-release/slack",
279
+
//diff-add
280
+
"semantic-release-slack-bot",
281
+
//diff-add
286
282
{
287
-
...
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
288
297
}
289
-
],
298
+
]
299
+
],
290
300
```
291
301
292
302
@@ -302,4 +312,12 @@ Also add this secterd to `.woodpecker.yml`:
302
312
- NPM_TOKEN
303
313
//diff-add
304
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