|
| 1 | +// https://semantic-release.gitbook.io/semantic-release/usage/configuration |
| 2 | +const pkg = require('./package.json'); |
| 3 | +const branch = process.env.BRANCH || process.env.CI_REF_NAME || ''; |
| 4 | +const branchSlug = branch.replace(/\//g, '-'); |
| 5 | +const branchPrefix = branch.split('/')[0]; |
| 6 | + |
| 7 | +const isMaster = branch === 'master' || branch === 'main'; |
| 8 | +// semantic-release configuration |
| 9 | +module.exports = { |
| 10 | + branches: [ |
| 11 | + { |
| 12 | + name: 'master', |
| 13 | + prerelease: false, |
| 14 | + }, |
| 15 | + { |
| 16 | + name: 'main', |
| 17 | + prerelease: false, |
| 18 | + }, |
| 19 | + { |
| 20 | + name: 'next', |
| 21 | + prerelease: 'next', |
| 22 | + }, |
| 23 | + { |
| 24 | + name: 'develop', |
| 25 | + prerelease: 'beta', |
| 26 | + }, |
| 27 | + { name: branchSlug, prerelease: 'alpha' }, |
| 28 | + { name: `${branchPrefix}/**`, prerelease: 'alpha' }, |
| 29 | + ], |
| 30 | + plugins: [ |
| 31 | + [ |
| 32 | + '@semantic-release/commit-analyzer', |
| 33 | + { |
| 34 | + preset: 'angular', |
| 35 | + releaseRules: [ |
| 36 | + { type: 'breaking', release: 'major' }, |
| 37 | + { type: 'feat', release: 'minor' }, |
| 38 | + { type: 'fix', release: 'patch' }, |
| 39 | + { type: 'revert', release: 'patch' }, |
| 40 | + { type: 'docs', release: 'patch' }, |
| 41 | + { type: 'refactor', release: 'patch' }, |
| 42 | + { type: 'style', release: 'patch' }, |
| 43 | + { type: 'test', release: 'patch' }, |
| 44 | + { type: 'chore', release: 'patch' }, |
| 45 | + { type: 'ci', release: 'patch' }, |
| 46 | + { type: 'perf', release: 'patch' }, |
| 47 | + { type: 'build', release: 'patch' }, |
| 48 | + ], |
| 49 | + }, |
| 50 | + ], |
| 51 | + ['@semantic-release/release-notes-generator'], |
| 52 | + // https://github.com/semantic-release/npm |
| 53 | + ['@semantic-release/npm'], |
| 54 | + // https://github.com/semantic-release/github |
| 55 | + [ |
| 56 | + '@semantic-release/github', |
| 57 | + { |
| 58 | + successComment: false, |
| 59 | + failComment: false, |
| 60 | + }, |
| 61 | + ], |
| 62 | + // https://github.com/semantic-release/git |
| 63 | + isMaster && [ |
| 64 | + '@semantic-release/git', |
| 65 | + { |
| 66 | + assets: ['package.json', 'package-lock.json', 'yarn.lock', 'npm-shrinkwrap.json', 'CHANGELOG.md'], |
| 67 | + message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', |
| 68 | + GIT_AUTHOR_NAME: pkg.author.name, |
| 69 | + GIT_AUTHOR_EMAIL: pkg.author.email, |
| 70 | + GIT_COMMITTER_NAME: pkg.author.name, |
| 71 | + GIT_COMMITTER_EMAIL: pkg.author.email, |
| 72 | + }, |
| 73 | + ], |
| 74 | + ].filter(Boolean), |
| 75 | +}; |
0 commit comments