Skip to content

Commit 8be454e

Browse files
committed
Fix release workflow version calculation
- For patch releases, use current SNAPSHOT version without incrementing - Calculate next development version based on release type - Prevents skipping version numbers in release process
1 parent beffcf1 commit 8be454e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
5757
- name: Prepare release
5858
run: |
59-
# Determine next version based on input
59+
# Determine release version based on input
6060
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=dynamodb-toolkit.version -q -DforceStdout)
6161
BASE_VERSION=$(echo $CURRENT_VERSION | sed 's/-SNAPSHOT//')
6262
@@ -68,7 +68,8 @@ jobs:
6868
NEW_VERSION=$(echo $BASE_VERSION | awk -F. '{print $1"."($2+1)".0"}')
6969
;;
7070
"patch")
71-
NEW_VERSION=$(echo $BASE_VERSION | awk -F. '{print $1"."$2"."($3+1)}')
71+
# For patch releases, use the current SNAPSHOT version (just remove -SNAPSHOT)
72+
NEW_VERSION=$BASE_VERSION
7273
;;
7374
esac
7475
@@ -94,8 +95,18 @@ jobs:
9495
9596
- name: Prepare next development version
9697
run: |
97-
# Calculate next development version
98-
NEXT_DEV_VERSION=$(echo $NEW_VERSION | awk -F. '{print $1"."$2"."($3+1)"-SNAPSHOT"}')
98+
# Calculate next development version based on the version type
99+
case "${{ github.event.inputs.version_type }}" in
100+
"major")
101+
NEXT_DEV_VERSION=$(echo $NEW_VERSION | awk -F. '{print $1".1.0-SNAPSHOT"}')
102+
;;
103+
"minor")
104+
NEXT_DEV_VERSION=$(echo $NEW_VERSION | awk -F. '{print $1"."$2".1-SNAPSHOT"}')
105+
;;
106+
"patch")
107+
NEXT_DEV_VERSION=$(echo $NEW_VERSION | awk -F. '{print $1"."$2"."($3+1)"-SNAPSHOT"}')
108+
;;
109+
esac
99110
100111
# Update to next development version
101112
sed -i "s/<dynamodb-toolkit.version>.*<\/dynamodb-toolkit.version>/<dynamodb-toolkit.version>$NEXT_DEV_VERSION<\/dynamodb-toolkit.version>/" pom.xml

0 commit comments

Comments
 (0)