Skip to content

Commit 915f5ea

Browse files
committed
Fixed creating/finalizing minor release
1 parent 825a78b commit 915f5ea

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

release.sh

+13-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ if [[ "$HELP" == "--help" || "$HELP" == "-h" ]]; then
1414
echo """
1515
Run this script on either '$MAIN_BRANCH' or '${RELEASE_PREFIX}X.X' branch.
1616
17-
For minor releases:
17+
For creating a new release:
1818
On '$MAIN_BRANCH' branch, it will create a new release branch '${RELEASE_PREFIX}X.X' and bump the minor version on '$MAIN_BRANCH'.
1919
20-
For patch or prereleases:
21-
On '${RELEASE_PREFIX}X.X' branch, it asks for a type (patch or prerelease) and creates a tag.
20+
For finalizing a minor or patch releases or prereleases:
21+
On '${RELEASE_PREFIX}X.X' branch, it asks for a type (minor/patch/prerelease) and creates a tag.
2222
"""
2323
exit 0
2424
fi
@@ -71,12 +71,20 @@ fi
7171
if [[ $BRANCH =~ $RELEASE_REGEX ]]; then
7272
# Determine which release type
7373
TYPE=$1
74-
if [[ ! " patch prerelease " =~ " $TYPE " ]]; then
75-
echo "Usage: $0 <patch|prerelease>"
74+
if [[ ! " minor patch prerelease " =~ " $TYPE " ]]; then
75+
echo "Usage: $0 <minor|patch|prerelease>"
7676
echo "Run '--help' for more information."
7777
exit 1
7878
fi
7979

80+
# Check if minor release then check if patch version is 0 and is preview
81+
if [[ "$TYPE" == "minor" ]]; then
82+
if [[ "$PATCH" != "0" || "$VERSION" != *"$PRE_ID_PREVIEW"* ]]; then
83+
echo "Minor release is only allowed if the current version is 'X.X.0-$PRE_ID_PREVIEW.X'."
84+
exit 1
85+
fi
86+
fi
87+
8088
echo "Finalize release [BRANCH=$BRANCH, VERSION=$VERSION, TYPE=$TYPE]"
8189

8290
# Fetch all remote tags

0 commit comments

Comments
 (0)