forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: multiple release branches without merge conflicts (aws#11307)
As we prepare for 2.0, we need to release the CDK concurrently in multiple version lines (1.x and 2.0.0-alpha.x). In order to avoid merge conflicts of `lerna.json` and `CHANGELOG.md` between the v1 and v2 branches, we extracted the version number from `lerna.json` to `version.vNNN.json` and changelog to `CHANGELOG.vNNN.json` (1.0 is still CHANGELOG.md because it is tracked externally). A new file called `release.json` has been introduced and includes *static* information about which version line this branch serves. This allows us to avoid merge conflicts caused by version bumps between release branches. This change also cleans up some of the scripts related to versioning and bumps. The main bump script is now implemented in `scripts/bump.js` and interacts with `standard-version` as a library instead of through the CLI. To that end, the `.versionrc.json` file was also removed. See CONTRIBUTING for more details about how this works. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Elad Ben-Israel
authored
Nov 5, 2020
1 parent
884539b
commit 1ec7e62
Showing
24 changed files
with
406 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,4 @@ yarn-error.log | |
# Cloud9 | ||
.c9 | ||
|
||
/.versionrc.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"majorVersion": 1, | ||
"releaseType": "stable" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env node | ||
const standardVersion = require('standard-version'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const ver = require('./resolve-version'); | ||
const repoRoot = path.join(__dirname, '..'); | ||
|
||
const releaseAs = process.argv[2] || 'minor'; | ||
const forTesting = process.env.BUMP_CANDIDATE || false; | ||
|
||
async function main() { | ||
if (releaseAs !== 'minor' && releaseAs !== 'patch') { | ||
throw new error(`invalid bump type "${releaseAs}". only "minor" (the default) and "patch" are allowed. major version bumps require *slightly* more intention`); | ||
} | ||
|
||
console.error(`Starting ${releaseAs} version bump`); | ||
console.error('Current version information:', JSON.stringify(ver, undefined, 2)); | ||
|
||
const changelogPath = path.join(repoRoot, ver.changelogFile); | ||
const opts = { | ||
releaseAs: releaseAs, | ||
skip: { tag: true }, | ||
packageFiles: [ { filename: ver.versionFile, type: 'json' } ], | ||
bumpFiles: [ { filename: ver.versionFile, type: 'json' } ], | ||
infile: ver.changelogFile, | ||
prerelease: ver.prerelease, | ||
scripts: { | ||
postchangelog: `${path.join(__dirname, 'changelog-experimental-fix.sh')} ${changelogPath}` | ||
} | ||
}; | ||
|
||
if (forTesting) { | ||
opts.skip.commit = true; | ||
opts.changelog = true; | ||
|
||
// if we are on a "stable" branch, add a pre-release tag ("rc") to the | ||
// version number as a safety in case this version will accidentally be | ||
// published. | ||
opts.prerelease = ver.prerelease || 'rc' | ||
console.error(`BUMP_CANDIDATE is set, so bumping version for testing (with the "${opts.prerelease}" prerelease tag)`); | ||
} | ||
|
||
return standardVersion(opts); | ||
} | ||
|
||
main().catch(err => { | ||
console.error(err.stack); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
changelog="${1:-}" | ||
|
||
if [ -z "${changelog}" ]; then | ||
echo "Usage: $0 CHANGELOG.md" | ||
exit 1 | ||
fi | ||
|
||
sed -i.tmp -e 's/BREAKING CHANGES$/BREAKING CHANGES TO EXPERIMENTAL FEATURES/' ${changelog} | ||
rm ${changelog}.tmp |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.