Skip to content

Commit

Permalink
chore: updates to the bump script (#201)
Browse files Browse the repository at this point in the history
* chore: updates to the bump script

Fixes #173 and #200

* Added automation for bumping the RFDK version in the python example
* Added automation for adding a section to the changelog that lists the
version of CDK that this version of RFDK depends on

* Addressed PR feedback
  • Loading branch information
horsmand authored Nov 4, 2020
1 parent ae9e6a7 commit 0c1b37c
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ version=${1:-minor}

cd "$(dirname "$0")"

echo "Starting ${version} version bump"
echo "Starting $version version bump"

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

/bin/bash ./install.sh

npx lerna version ${version} --yes --exact --no-git-tag-version --no-push
npx lerna version $version --yes --exact --no-git-tag-version --no-push

# Another round of install to fix package-lock.jsons
/bin/bash ./install.sh
Expand All @@ -39,3 +39,27 @@ npx lerna version ${version} --yes --exact --no-git-tag-version --no-push

# Generate CHANGELOG and create a commit
npx standard-version --skip.tag=true --commit-all

# Get the new version number to do some manual find and replaces
new_version=$(node -p "require('./package.json').version")

# Update the version of RFDK used in the python examples
for exampleSetupPy in $(find ./examples/ -name 'setup.py')
do
sed -i "s/\"aws-rfdk==[0-9]*\.[0-9]*\.[0-9]*\"/\"aws-rfdk==$new_version\"/" "$exampleSetupPy"
done

# When standard-version adds a patch release to the changelog, it makes it a smaller header size. This undoes that.
if [[ $version == "patch" ]]; then
version_header="#\(## \[$new_version](.*) (.*)\)"
sed -i "s|$version_header|\1|" ./CHANGELOG.md
fi

# Add a section to the changelog that state the version of CDK being used
version_header="# \[$new_version](.*) (.*)"
cdk_version=$(node -p "require('./package.json').devDependencies['aws-cdk']")
cdk_version_section="\n\n\n### Supported CDK Version\n\n* [$cdk_version](https://github.com/aws/aws-cdk/releases/tag/v$cdk_version)"
sed -i "s|\($version_header\)|\1$cdk_version_section|" ./CHANGELOG.md

git add .
git commit --amend --no-edit

0 comments on commit 0c1b37c

Please sign in to comment.