Skip to content

Commit 728577a

Browse files
chore: add semantic release config
1 parent e555454 commit 728577a

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"devDependencies": {
3+
"semantic-release-preconfigured-conventional-commits": "1.1.17"
4+
},
5+
"engines": {
6+
"node": "18.15"
7+
}
8+
}

release.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Load this configuration that provide all the base for working with conventional commits
2+
const config = require('semantic-release-preconfigured-conventional-commits')
3+
4+
/*
5+
Commands executed during release.
6+
It also set an environment variable "release" indicating that the release was successful.
7+
*/
8+
const publishCommands = `
9+
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md || exit 2
10+
git push --force origin \${nextRelease.version} || exit 3
11+
echo "release_status=released" >> $GITHUB_ENV
12+
echo "CONTAINER_VERSION="\${nextRelease.version} >> $GITHUB_ENV
13+
`
14+
// Only release on branch main
15+
const releaseBranches = ["main"]
16+
17+
config.branches = releaseBranches
18+
19+
config.plugins.push(
20+
// Custom release commands
21+
["@semantic-release/exec", {
22+
"publishCmd": publishCommands,
23+
}],
24+
// Release also in GitHub
25+
["@semantic-release/github", {
26+
"assets": []
27+
}],
28+
["@semantic-release/git", {
29+
"assets": ["CHANGELOG.md", "package.json"],
30+
"message": "chore(release)!: [skip ci] ${nextRelease.version} released"
31+
}]
32+
)
33+
34+
// JS Semantic Release configuration must export the JS configuration object
35+
module.exports = config

0 commit comments

Comments
 (0)