-
Notifications
You must be signed in to change notification settings - Fork 59
/
.releaserc.js
executable file
·79 lines (74 loc) · 2.43 KB
/
.releaserc.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
76
77
78
79
const { execSync } = require('child_process');
const path = require('path');
/**
*
* @returns Production release configuration
*/
function getProdConfiguration() {
return {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogTitle:
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
},
],
// set package.json version
[
'@semantic-release/exec',
{
// eslint-disable-next-line no-template-curly-in-string
prepareCmd: 'make update_npmversion VERSION=${nextRelease.version}',
},
],
'@semantic-release/github',
],
};
}
/**
*
* ################################################################
* ################################################################
* ################ FOR TESTING ##########################
* ################################################################
* ################################################################
*/
function isTestRun() {
return process.argv.includes('--dry-run') || process.argv.includes('--test-run');
}
function getTestConfiguration() {
const localGitRepoPath = `file://${process.cwd()}/.git`;
const localBranchName = execSync('git branch --show-current').toString().trim();
return {
repositoryUrl: localGitRepoPath,
branches: localBranchName,
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogTitle:
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
},
],
// set package.json version
[
'@semantic-release/exec',
{
// eslint-disable-next-line no-template-curly-in-string
prepareCmd: 'make update_npmversion VERSION=${nextRelease.version}',
},
],
// ["@semantic-release/github", {
// "verifyConditions": false,
// "publish": false,
// 'addReleases': false
// }],
],
};
}
module.exports = isTestRun() ? getTestConfiguration() : getProdConfiguration();