-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.config.js
35 lines (33 loc) · 1.05 KB
/
release.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { promisify } = require("node:util");
const exec = promisify(require("node:child_process").exec);
/** @type {import('semantic-release').Options} */
module.exports = {
branches: ["+([0-9])?(.{+([0-9]),x}).x", "main", "next"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
{
/**
* @param {*} _
* @param {import('semantic-release').Context} param1
*/
success(_, { nextRelease: { version }, logger }) {
if (version.match(/[^0-9\.]/)) {
logger.info(
"Prerelease version detected; will not add a major version tag."
);
return;
}
const [major, minor] = version.split(".");
return Promise.all(
[major, `${major}.${minor}`].map(async (v) => {
logger.info(`Pushing new version tag ${v} to git.`);
await exec(`git tag --force v${v}`);
await exec(`git push origin v${v} --force`);
})
);
},
},
],
};