Skip to content

Commit

Permalink
chore: enhance bump script to default to a minor version bump (aws#4389)
Browse files Browse the repository at this point in the history
* chore: enhance bump script to default to a minor version bump

Also supports any semVer string as input for scenarios where we want to release patches, major versions, etc.
Made a switch to use standard-version to create a commit at the end of the bump. standard-version also takes
care of the CHANGELOG generation now.

* use npx to execute standard-version
  • Loading branch information
shivlaks authored and mergify[bot] committed Oct 9, 2019
1 parent 540f9b2 commit 11d18e0
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 15 deletions.
34 changes: 19 additions & 15 deletions bump.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
#!/bin/bash
# --------------------------------------------------------------------------------------------------
#
# This script is intended to be used to bump the version of the CDK modules, update package.json,
# package-lock.json, and create a commit.
#
# to start a version bump, run:
# bump.sh <version | version Type>
#
# If a version is not provided, the 'minor' version will be bumped.
# The version can be an explicit version _or_ one of:
# 'major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', or 'prerelease'.
#
# --------------------------------------------------------------------------------------------------
set -euo pipefail
ver=${1:-}
if [ -z "${ver}" ]; then
echo "usage: ./bump.sh <version>"
exit 1
fi
version=${1:-minor}

echo "Starting ${version} version bump"

export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}"

/bin/bash ./install.sh

npx lerna version --force-publish=* --no-git-tag-version --no-push ${ver}

# Update CHANGELOG.md only at the root
cat > /tmp/context.json <<HERE
{
"version": "${ver}"
}
HERE
npx lerna version ${version} --force-publish=* --no-git-tag-version --no-push

# Another round of install to fix package-lock.jsons
/bin/bash ./install.sh

./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s --context /tmp/context.json

# align "peerDependencies" to actual dependencies after bump
# this is technically only required for major version bumps, but in the meantime we shall do it in every bump
/bin/bash scripts/fix-peer-deps.sh

# Generate CHANGELOG and create a commit
npx standard-version --release --skip.tag=true --commit-all
256 changes: 256 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lerna": "^3.16.5",
"nodeunit": "^0.11.3",
"nyc": "^14.1.1",
"standard-version": "^7.0.0",
"ts-jest": "^24.1.0",
"tslint": "^5.20.0",
"typescript": "~3.6.3"
Expand All @@ -26,6 +27,13 @@
"type": "git",
"url": "git://github.com/aws/aws-cdk"
},
"standard-version": {
"releaseCommitMessageFormat": "{{currentTag}}",
"scripts": {
"prebump": "echo $(node -pe \"require('./lerna.json').version\")",
"precommit": "git add ."
}
},
"license": "Apache-2.0",
"author": {
"name": "Amazon Web Services",
Expand Down

0 comments on commit 11d18e0

Please sign in to comment.