-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.config.js
More file actions
109 lines (107 loc) · 3.33 KB
/
release.config.js
File metadata and controls
109 lines (107 loc) · 3.33 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import fs from 'node:fs';
const DRY_RUN = false;
const packageFilePath = `${process.cwd()}/package.json`;
const packageFile = JSON.parse(fs.readFileSync(packageFilePath));
const [_org, scope] = packageFile.name.split('/');
/**
* https://github.com/semantic-release/semantic-release
*
* Monorepo support: scope-based filtering via releaseRules (commit-analyzer)
* and ignoreCommits (release-notes-generator). Wireit handles release ordering.
*/
export default {
dryRun: DRY_RUN,
// ci: false, // enable to bypass local dry run https://github.com/semantic-release/semantic-release/issues/1316
tagFormat: `${packageFile.name}-v\${version}`,
branches: ['main'],
plugins: [
[
'@semantic-release/commit-analyzer',
{
releaseRules: [
// Catch-all first: suppress default rules (false acts as baseline)
{ breaking: true, release: false },
{ type: 'feat', release: false },
{ type: 'fix', release: false },
{ type: 'perf', release: false },
{ type: 'revert', release: false },
{ type: 'chore', release: false },
// Scope-matched rules last: override false for matching scope
{ breaking: true, scope, release: 'major' },
{ type: 'feat', scope, release: 'minor' },
{ type: 'fix', scope, release: 'patch' }
]
}
],
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
presetConfig: {
ignoreCommits: `^(?![^]*\\(${scope}\\))(?![^]*\\[${scope}\\]).*$`
}
}
],
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md'
}
],
[
'semantic-release-replace-plugin',
{
replacements: [
{
files: [packageFilePath],
from: `"version": "${packageFile.version}"`,
to: '"version": "${nextRelease.version}"',
results: [
{
file: packageFilePath,
hasChanged: true,
numMatches: 1,
numReplacements: 1
}
],
countMatches: true
},
{
files: [`${process.cwd()}/dist/**/*.js`],
from: '"0.0.0"',
to: '"${nextRelease.version}"',
allowEmptyPaths: true
}
]
}
],
[
'@semantic-release/exec',
{
publishCmd: `pnpm publish --no-git-checks --registry=https://registry.npmjs.org ${DRY_RUN ? '--dry-run' : ''}`
}
],
[
'@semantic-release/git',
{
assets: ['CHANGELOG.md', 'package.json', 'projects/**/package.json', 'projects/**/CHANGELOG.md'],
message: `chore(release): ${packageFile.name}` + '-v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}
],
[
'@semantic-release/github',
{
successComment:
'🎉 This issue has been resolved in version ${nextRelease.version} 🎉\n\n[Changelog](https://NVIDIA.github.io/elements/docs/changelog/)',
assets: [
{
label: packageFile.name,
type: 'package',
name: `${packageFile.name.replace('/', '-')}-\${nextRelease.version}.tgz`,
path: `${packageFile.name.replace('/', '-')}-\${nextRelease.version}.tgz`
}
]
}
]
]
};