|
1 | 1 | // release.config.cjs |
2 | 2 | module.exports = { |
3 | 3 | branches: ["main", { name: "next", prerelease: true }], |
| 4 | + |
| 5 | + // Debug mode |
| 6 | + debug: process.env.CI ? false : true, |
| 7 | + |
4 | 8 | plugins: [ |
5 | 9 | // 1. Analyze commits to determine release type |
6 | | - "@semantic-release/commit-analyzer", |
| 10 | + [ |
| 11 | + "@semantic-release/commit-analyzer", |
| 12 | + { |
| 13 | + preset: "angular", |
| 14 | + releaseRules: [ |
| 15 | + // Documentation changes |
| 16 | + { type: "docs", release: "patch" }, |
| 17 | + { type: "doc", release: "patch" }, |
7 | 18 |
|
8 | | - // 2. Generate release notes from commits |
9 | | - "@semantic-release/release-notes-generator", |
| 19 | + // Code improvements |
| 20 | + { type: "refactor", release: "patch" }, |
| 21 | + { type: "perf", release: "patch" }, |
10 | 22 |
|
11 | | - // 3. Update CHANGELOG.md file |
12 | | - "@semantic-release/changelog", |
| 23 | + // Features and fixes (default behavior) |
| 24 | + { type: "feat", release: "minor" }, |
| 25 | + { type: "fix", release: "patch" }, |
13 | 26 |
|
14 | | - // 4. Update package.json version and publish to NPM |
15 | | - "@semantic-release/npm", |
| 27 | + // Breaking changes |
| 28 | + { breaking: true, release: "major" }, |
16 | 29 |
|
17 | | - // 5. Create Git tag and GitHub release with notes |
18 | | - "@semantic-release/github", |
| 30 | + // No release for these |
| 31 | + { type: "style", release: false }, |
| 32 | + { type: "chore", release: false }, |
| 33 | + { type: "test", release: false }, |
| 34 | + { type: "ci", release: false }, |
| 35 | + { type: "build", release: false }, |
| 36 | + ], |
| 37 | + parserOpts: { |
| 38 | + noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"], |
| 39 | + }, |
| 40 | + }, |
| 41 | + ], |
19 | 42 |
|
20 | | - // 6. Commit updated files (package.json, CHANGELOG.md) |
| 43 | + // 2. Generate release notes |
| 44 | + [ |
| 45 | + "@semantic-release/release-notes-generator", |
| 46 | + { |
| 47 | + preset: "angular", |
| 48 | + writerOpts: { |
| 49 | + commitsSort: ["subject", "scope"], |
| 50 | + }, |
| 51 | + }, |
| 52 | + ], |
| 53 | + |
| 54 | + // 3. Update CHANGELOG.md |
| 55 | + [ |
| 56 | + "@semantic-release/changelog", |
| 57 | + { |
| 58 | + changelogFile: "CHANGELOG.md", |
| 59 | + }, |
| 60 | + ], |
| 61 | + |
| 62 | + // 4. Update package.json and publish to NPM |
| 63 | + [ |
| 64 | + "@semantic-release/npm", |
| 65 | + { |
| 66 | + npmPublish: true, |
| 67 | + tarballDir: "dist", |
| 68 | + }, |
| 69 | + ], |
| 70 | + |
| 71 | + // 5. Create GitHub release |
| 72 | + [ |
| 73 | + "@semantic-release/github", |
| 74 | + { |
| 75 | + assets: [ |
| 76 | + { |
| 77 | + path: "dist/*.tgz", |
| 78 | + label: "Package tarball", |
| 79 | + }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + ], |
| 83 | + |
| 84 | + // 6. Commit updated files (must be last) |
21 | 85 | [ |
22 | 86 | "@semantic-release/git", |
23 | 87 | { |
24 | | - assets: ["CHANGELOG.md", "package.json"], |
| 88 | + assets: ["CHANGELOG.md", "package.json", "package-lock.json"], |
25 | 89 | message: |
26 | 90 | "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", |
27 | 91 | }, |
28 | 92 | ], |
29 | 93 | ], |
30 | | - |
31 | | - // Commit message rules (conventional commits) |
32 | | - preset: "angular", |
33 | | - |
34 | | - // Custom release rules |
35 | | - releaseRules: [ |
36 | | - { type: "docs", scope: "README", release: "patch" }, |
37 | | - { type: "refactor", release: "patch" }, |
38 | | - { type: "perf", release: "patch" }, |
39 | | - { type: "style", release: false }, |
40 | | - { type: "chore", release: false }, |
41 | | - { type: "test", release: false }, |
42 | | - { type: "ci", release: false }, |
43 | | - ], |
44 | | - |
45 | | - // Configure release notes generation |
46 | | - generateNotes: { |
47 | | - preset: "angular", |
48 | | - writerOpts: { |
49 | | - commitsSort: ["subject", "scope"], |
50 | | - }, |
51 | | - }, |
52 | 94 | }; |
0 commit comments