Skip to content

Commit 03415fb

Browse files
chore(release): enhance semantic release configuration with conventional commits support
1 parent b7c6bb7 commit 03415fb

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

release.config.js

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,55 @@ const fs = require("fs");
33
module.exports = {
44
branches: ["main"],
55
plugins: [
6-
"@semantic-release/commit-analyzer", // Detects the release type (major, minor, patch)
7-
"@semantic-release/release-notes-generator", // Generates release notes
8-
"@semantic-release/changelog", // Updates CHANGELOG.md
6+
[
7+
"@semantic-release/commit-analyzer", // Detects the release type (major, minor, patch)
8+
{
9+
preset: "conventionalcommits",
10+
releaseRules: [
11+
// Ignore merge commits
12+
{ subject: "*Merge pull request*", release: false },
13+
{ subject: "*Merge branch*", release: false },
14+
// Ignore chore commits (they won't trigger releases)
15+
{ type: "chore", release: false },
16+
// You can also ignore other types if needed
17+
{ type: "docs", release: false },
18+
{ type: "style", release: false },
19+
{ type: "refactor", release: false },
20+
{ type: "test", release: false },
21+
// Standard rules for releases
22+
{ type: "feat", release: "minor" },
23+
{ type: "fix", release: "patch" },
24+
{ type: "perf", release: "patch" },
25+
// Breaking changes always trigger major
26+
{ breaking: true, release: "major" },
27+
],
28+
},
29+
],
30+
[
31+
"@semantic-release/release-notes-generator", // Generates release notes,
32+
{
33+
preset: "conventionalcommits",
34+
presetConfig: {
35+
types: [
36+
{ type: "feat", section: "Features" },
37+
{ type: "fix", section: "Bug Fixes" },
38+
{ type: "perf", section: "Performance Improvements" },
39+
// Exclude chore from release notes
40+
{ type: "chore", hidden: true },
41+
{ type: "docs", hidden: true },
42+
{ type: "style", hidden: true },
43+
{ type: "refactor", hidden: true },
44+
{ type: "test", hidden: true },
45+
],
46+
},
47+
},
48+
],
49+
[
50+
"@semantic-release/changelog", // Updates CHANGELOG.md
51+
{
52+
preset: "conventionalcommits",
53+
},
54+
],
955
[
1056
{
1157
// Hook to update pubspec.yaml
@@ -27,7 +73,7 @@ module.exports = {
2773
"@semantic-release/git", // Commits CHANGELOG and bumps version if needed
2874
{
2975
assets: ["CHANGELOG.md", "pubspec.yaml"],
30-
message: "chore(release): ${nextRelease.version} [skip ci]",
76+
message: "chore(release): ${nextRelease.version}",
3177
},
3278
],
3379
"@semantic-release/github", // Publishes to GitHub Releases

0 commit comments

Comments
 (0)