-
Notifications
You must be signed in to change notification settings - Fork 42
/
bump.sh
executable file
·80 lines (64 loc) · 3.35 KB
/
bump.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# --------------------------------------------------------------------------------------------------
#
# This script is intended to be used to bump the version of the RFDK 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'.
#
# This script utilizes the "lerna version" feature as well as the "standard-version" node package
# https://github.com/lerna/lerna/tree/master/commands/version
# https://www.npmjs.com/package/standard-version
#
# --------------------------------------------------------------------------------------------------
set -euxo pipefail
current_version=$(node -p "require('./package.json').version")
if test "${current_version}" = "0.42.0"; then
# The version after 0.42.0 will be 1.0.0
version=${1:-major}
else
version=${1:-minor}
fi
cd "$(dirname "$0")"
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
# Another round of install to fix package-lock.jsons
/bin/bash ./install.sh
# 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 --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
version_header="# \[$new_version](.*) (.*)"
# Add a section to the changelog that states the supported Deadline versions
DEADLINE_RELEASE_NOTE_URL="https://docs.thinkboxsoftware.com/products/deadline/10.3/1_User%20Manual/manual/release-notes.html"
DEADLINE_SUPPORTED_VERSIONS=$(node ./scripts/getSupportedDeadlineVersions.ts)
MIN_DEADLINE_VERSION=$(echo "$DEADLINE_SUPPORTED_VERSIONS" | grep 'Min' | cut -f 2 -d ' ')
MAX_DEADLINE_VERSION=$(echo "$DEADLINE_SUPPORTED_VERSIONS" | grep 'Max' | cut -f 2 -d ' ')
deadline_version_section="\n\n\n### Officially Supported Deadline Versions\n\n* [${MIN_DEADLINE_VERSION} to ${MAX_DEADLINE_VERSION}](${DEADLINE_RELEASE_NOTE_URL})"
sed -i "s|\($version_header\)|\1$deadline_version_section|" ./CHANGELOG.md
# Add a section to the changelog that state the version of CDK being used
cdk_version=$(node -p "require('./package.json').devDependencies['aws-cdk-lib']")
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