Skip to content

Commit

Permalink
fixed release action script to cover beta versions. eg: v1.55.2-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
willianpc committed Sep 22, 2023
1 parent 0dcbbf0 commit 254d559
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions release_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build_major() {
# - v1 was never released, so FOUND_VERSION_IN_TAG=0.0.0 and NEW_MAJOR_VERSION is empty. NEW_VERSION should be 1.0.0
# - v2 or higher was never released, so FOUND_VERSION_IN_TAG=0.0.0 and NEW_MAJOR_VERSION is 2, 3, 4... NEW_VERSION should be 2.0.0, or higher

MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')
MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+.*/\1/p')

if [ "$MAJOR_VERSION" != "0" ]; then
echo "Cannot release new major version '$NEW_MAJOR_VERSION' with existing tag $FOUND_VERSION_IN_TAG"
Expand All @@ -27,8 +27,8 @@ build_minor() {
exit 1
fi

MINOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.([0-9]+)\.[0-9]+/\1/p')
MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')
MINOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.([0-9]+)\.[0-9]+.*/\1/p')
MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+.*/\1/p')
MINOR_VERSION=$((MINOR_VERSION+1))
NEW_VERSION="$MAJOR_VERSION.$MINOR_VERSION.0"
}
Expand All @@ -41,9 +41,9 @@ build_patch() {
exit 1
fi

PATCH_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.[0-9]+\.([0-9]+)/\1/p')
MINOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.([0-9]+)\.[0-9]+/\1/p')
MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')
PATCH_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.[0-9]+\.([0-9]+).*/\1/p')
MINOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/[0-9]+\.([0-9]+)\.[0-9]+.*/\1/p')
MAJOR_VERSION=$(echo "$FOUND_VERSION_IN_TAG" | sed -En 's/([0-9]+)\.[0-9]+\.[0-9]+.*/\1/p')
PATCH_VERSION=$((PATCH_VERSION+1))
NEW_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
}
Expand Down

0 comments on commit 254d559

Please sign in to comment.