-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.config.cjs
More file actions
84 lines (84 loc) · 2.42 KB
/
release.config.cjs
File metadata and controls
84 lines (84 loc) · 2.42 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @type {import('semantic-release').GlobalConfig}
* 基於 Context7 最佳實踐的現代化 semantic-release 配置
* [context7:semantic-release/semantic-release:2025-08-16T18:26:00+08:00]
*/
module.exports = {
branches: [
'main',
{ name: 'beta', prerelease: true },
{ name: 'alpha', prerelease: true },
// 維護分支支援
'+([0-9])?(.{+([0-9]),x}).x',
],
plugins: [
// 提交分析器 - 使用最新配置
[
'@semantic-release/commit-analyzer',
{
releaseRules: [
{ type: 'feat', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'docs', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'test', release: 'patch' },
{ type: 'chore', release: 'patch' },
{ type: 'ci', release: 'patch' },
{ breaking: true, release: 'major' },
],
},
],
// 發布說明生成器
'@semantic-release/release-notes-generator',
// 變更記錄生成器
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md',
changelogTitle: '# 📋 更新記錄\n\n所有重要變更都會記錄在此文件中。',
},
],
// 執行自定義命令
[
'@semantic-release/exec',
{
prepareCmd: 'npm run update-version-files',
publishCmd: 'npm run post-publish',
},
],
// Git 提交配置
[
'@semantic-release/git',
{
assets: ['package.json', 'package-lock.json', 'CHANGELOG.md'],
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
// GitHub 發布配置 - 支援討論和資產上傳
[
'@semantic-release/github',
{
successComment: '🎉 此議題已在版本 ${nextRelease.version} 中發布',
failComment: '❌ 發布失敗,請檢查 CI 日誌',
releasedLabels: ['released'],
addReleases: 'bottom',
},
],
],
// 使用 conventional commits 預設
preset: 'conventionalcommits',
// 標籤格式
tagFormat: 'v${version}',
// 解析器選項
parserOpts: {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING-CHANGE'],
},
// 寫入器選項
writerOpts: {
groupBy: 'type',
commitGroupsSort: 'title',
commitsSort: 'header',
},
};