Skip to content

Commit

Permalink
chore: backport CHANGELOG generation fix (aws#13082)
Browse files Browse the repository at this point in the history
See aws#13019 for the original fix, which was committed to the v2-main branch.
This backports the change to the master/v1 branch.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
njlynch authored and NovakGu committed Feb 18, 2021
1 parent 33aaed0 commit c902b39
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/bump.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env node
const standardVersion = require('standard-version');
const fs = require('fs');
const path = require('path');
const semver = require('semver');
const ver = require('./resolve-version');
const { exec } = require('child_process');
const repoRoot = path.join(__dirname, '..');

const releaseAs = process.argv[2] || 'minor';
Expand Down Expand Up @@ -40,7 +41,19 @@ async function main() {
console.error(`BUMP_CANDIDATE is set, so bumping version for testing (with the "${opts.prerelease}" prerelease tag)`);
}

return standardVersion(opts);
// `standard-release` will -- among other things -- create the changelog.
// However, on the v2 branch, `conventional-changelog` (which `standard-release` uses) gets confused
// and creates really muddled changelogs with both v1 and v2 releases intermingled, and lots of missing data.
// A super HACK here is to locally remove all version tags that don't match this major version prior
// to doing the bump, and then later fetching to restore those tags.
const majorVersion = semver.major(ver.version);
await exec(`git tag -d $(git tag -l | grep -v '^v${majorVersion}.')`);

// Delay loading standard-version until the git tags have been pruned.
const standardVersion = require('standard-version');
await standardVersion(opts);

await exec('git fetch -t');
}

main().catch(err => {
Expand Down

0 comments on commit c902b39

Please sign in to comment.