-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.config.js
75 lines (69 loc) · 1.69 KB
/
release.config.js
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
const {execSync} = require('child_process')
const MAIN_BRANCH = 'main'
const packageName = process.env.PACKAGE_NAME
const tagFormat = packageName ?
`${packageName}-v\${version}` :
'all-v${version}'
const pkgRoot = packageName || '.'
const packageSubjectName = packageName || 'all'
const packagePackageJson = require(`./${pkgRoot}/package.json`)
const packageNpmName = packagePackageJson.name
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.replace('\n', '')
const branchSha = execSync('git rev-parse --short HEAD')
.toString()
.replace('\n', '')
const isMainBranch = branchName === MAIN_BRANCH
const extraGithubConfig = isMainBranch ?
{} :
{
successComment: `
This PR is part of this prerelease version on \`${packageNpmName}\` for testing: \${nextRelease.version}
You can test it by using:
\`\`\`bash
npm install ${packageNpmName}@${branchName}
\`\`\`
`,
}
const extraPlugins = isMainBranch ?
[
[
'@semantic-release/git',
{
message: `docs(${packageSubjectName}): \${nextRelease.version} [skip ci]\n\n\${nextRelease.note}`,
},
],
] :
[]
module.exports = {
repositoryUrl: 'git@github.com:im-open/text-mask.git',
tagFormat,
branches: [
'main',
{
name: '*',
prerelease: `\${name}-${branchSha}`,
channel: '${name}',
},
],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
[
'@semantic-release/npm',
{
pkgRoot,
},
],
[
'@semantic-release/github',
{
assets: ['../*.tgz', '../**/*.tgz'],
...extraGithubConfig,
},
],
...extraPlugins,
],
}