|
| 1 | +const { execSync } = require('child_process'); |
| 2 | +const MAIN_BRANCH = 'main'; |
| 3 | + |
| 4 | +const branchName = execSync('git rev-parse --abbrev-ref HEAD') |
| 5 | + .toString() |
| 6 | + .replace('\n', ''); |
| 7 | + |
| 8 | +const branchSha = execSync('git rev-parse --short HEAD') |
| 9 | + .toString() |
| 10 | + .replace('\n', ''); |
| 11 | + |
| 12 | +const isMainBranch = branchName === MAIN_BRANCH; |
| 13 | +const githubBranchConfig = isMainBranch |
| 14 | + ? {} |
| 15 | + : { |
| 16 | + successComment: ` |
| 17 | +This PR is part of this prerelease version for testing: \${nextRelease.version} |
| 18 | +
|
| 19 | +You can test it by using: |
| 20 | +\`\`\`bash |
| 21 | +npm install scriptloader-component@\${nextRelease.version} |
| 22 | +\`\`\` |
| 23 | + `, |
| 24 | + }; |
| 25 | + |
| 26 | +const extraPlugins = isMainBranch |
| 27 | + ? [ |
| 28 | + [ |
| 29 | + '@semantic-release/git', |
| 30 | + { |
| 31 | + message: |
| 32 | + 'Docs: ${nextRelease.version} [skip ci]\n\n${nextRelease.note}', |
| 33 | + assets: [ |
| 34 | + 'CHANGELOG.md', |
| 35 | + 'package.json', |
| 36 | + 'package-lock.json', |
| 37 | + 'npm-shrinkwrap.json', |
| 38 | + ], |
| 39 | + }, |
| 40 | + ], |
| 41 | + ] |
| 42 | + : []; |
| 43 | + |
1 | 44 | module.exports = { |
2 | 45 | repositoryUrl: 'git@github.com:WTW-IM/react-html-element.git', |
3 | 46 | branches: [ |
4 | 47 | { name: 'main' }, |
5 | 48 | { name: 'react-17', channel: 'react-17', prerelease: 'react-17' }, |
6 | 49 | { name: 'react-16', channel: 'react-16' }, |
| 50 | + { |
| 51 | + name: '*', |
| 52 | + channel: 'development', |
| 53 | + prerelease: `\${name}-${branchSha}`, |
| 54 | + }, |
7 | 55 | ], |
8 | 56 | plugins: [ |
9 | 57 | '@semantic-release/commit-analyzer', |
10 | 58 | '@semantic-release/release-notes-generator', |
11 | 59 | '@semantic-release/changelog', |
12 | | - '@semantic-release/github', |
13 | | - [ |
14 | | - '@semantic-release/git', |
15 | | - { |
16 | | - message: |
17 | | - 'Docs: ${nextRelease.version} [skip ci]\n\n${nextRelease.note}', |
18 | | - assets: [ |
19 | | - 'CHANGELOG.md', |
20 | | - 'package.json', |
21 | | - 'package-lock.json', |
22 | | - 'npm-shrinkwrap.json', |
23 | | - ], |
24 | | - }, |
25 | | - ], |
26 | 60 | '@semantic-release/npm', |
| 61 | + ['@semantic-release/github', { ...githubBranchConfig }], |
| 62 | + ...extraPlugins, |
27 | 63 | ], |
28 | 64 | preset: 'eslint', |
29 | 65 | }; |
0 commit comments