Skip to content

Commit

Permalink
fix: use changelog to determine new version
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Mar 11, 2020
1 parent 15bbc23 commit 6cda82a
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,11 @@ class ReleasePreparation {
patch: semver.patch(lastTagVersion)
};

const raw = this.getBranchDiff({
onlyNotableChanges: false,
comparisonBranch: `v${lastTagVersion}`
});
const changelog = this.getChangelog();

if (raw.includes('SEMVER-MAJOR')) {
if (changelog.includes('SEMVER-MAJOR')) {
newVersion = `${lastTag.major + 1}.0.0`;
} else if (raw.includes('SEMVER-MINOR')) {
} else if (changelog.includes('SEMVER-MINOR')) {
newVersion = `${lastTag.major}.${lastTag.minor + 1}.0`;
} else {
newVersion = `${lastTag.major}.${lastTag.minor}.${lastTag.patch + 1}`;
Expand Down Expand Up @@ -431,11 +428,11 @@ class ReleasePreparation {
branchDiffOptions = [
`${upstream}/${releaseBranch}`,
proposalBranch,
`--require-label=${notableLabels.join(',')}`,
`--require-label=${notableLabels.join(',')}`
];

if (opts.simple) {
branchDiffOptions.push('--simple')
branchDiffOptions.push('--simple');
}
} else {
const excludeLabels = [
Expand All @@ -451,15 +448,10 @@ class ReleasePreparation {
excludeLabels.push('semver-minor');
}

let comparisonBranch = 'master';
if (opts.comparisonBranch) {
comparisonBranch = opts.comparisonBranch;
}

branchDiffOptions = [
stagingBranch,
// TODO(codebytere): use Current branch instead of master for LTS
comparisonBranch,
'master',
`--exclude-label=${excludeLabels.join(',')}`,
'--filter-release'
];
Expand Down

0 comments on commit 6cda82a

Please sign in to comment.