Skip to content

Commit b6b2768

Browse files
lvyanquanclaude
authored andcommitted
[release] Improve version handling in deploy_staging_jars.sh (apache#4335)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 59cd5b8 commit b6b2768

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

tools/releasing/deploy_staging_jars.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ function set_pom_version {
5151
${MVN} org.codehaus.mojo:versions-maven-plugin:2.8.1:set -DnewVersion=${new_version} -DgenerateBackupPoms=false --quiet
5252
}
5353

54+
function set_revision_property {
55+
new_revision=$1
56+
57+
${MVN} org.codehaus.mojo:versions-maven-plugin:2.8.1:set-property -Dproperty=revision -DnewVersion=${new_revision} -DgenerateBackupPoms=false --quiet
58+
}
59+
5460
###########################
5561

5662
cd ${PROJECT_ROOT}
@@ -66,18 +72,23 @@ if [ -n "${FLINK_VERSION:-}" ]; then
6672
flink_major_version=$(echo "${FLINK_VERSION}" | cut -d. -f1,2)
6773
MVN_OPTIONS="${MVN_OPTIONS} -Dflink.major.version=${flink_major_version}"
6874

69-
# Update project version: base_version-FLINK_VERSION
75+
# Update project version: RELEASE_VERSION-FLINK_VERSION
7076
current_version=$(get_pom_version)
7177
echo "Current version: ${current_version}"
7278

73-
# Skip if version already ends with FLINK_VERSION
74-
if [[ "${current_version}" == *"-${FLINK_VERSION}" ]]; then
75-
echo "Version already ends with -${FLINK_VERSION}, skipping version update"
79+
if [ -z "${RELEASE_VERSION:-}" ]; then
80+
echo "ERROR: RELEASE_VERSION environment variable is required"
81+
exit 1
82+
fi
83+
new_version="${RELEASE_VERSION}-${FLINK_VERSION}"
84+
85+
# Skip if version already matches RELEASE_VERSION-FLINK_VERSION
86+
if [[ "${current_version}" == "${new_version}" ]]; then
87+
echo "Version already is ${new_version}, skipping version update"
7688
else
77-
base_version=${current_version%-SNAPSHOT}
78-
new_version="${base_version}-${FLINK_VERSION}"
7989
echo "Updating version to: ${new_version}"
8090
set_pom_version "${new_version}"
91+
set_revision_property "${new_version}"
8192
fi
8293

8394
# Add -Pflink2 profile if FLINK_VERSION starts with "2"

0 commit comments

Comments
 (0)