Skip to content

Commit c9d9fde

Browse files
gnodetclaude
andcommitted
Set SDKMAN default version for stable releases only
Skip setting the default for pre-release versions (alpha, beta, rc, snapshot, milestone) so that master can safely publish pre-releases without changing the default away from the latest stable release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f1b3e68 commit c9d9fde

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

build/publish-on-sdkman.sh

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,28 @@ publishRelease ${VERSION} MAC_OSX darwin-amd64
6464
publishRelease ${VERSION} MAC_ARM64 darwin-aarch64
6565
publishRelease ${VERSION} WINDOWS_64 windows-amd64
6666

67-
# master produces "betas" still, that must NOT be set as default
68-
# echo "Setting ${VERSION} as a default"
69-
# RESPONSE="$(curl -s -X PUT \
70-
# -H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \
71-
# -H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
72-
# -H "Content-Type: application/json" \
73-
# -H "Accept: application/json" \
74-
# -d '{"candidate": "mvnd", "version": "'${VERSION}'"}' \
75-
# https://vendors.sdkman.io/default)"
76-
#
77-
# node -pe "
78-
# var json = JSON.parse(process.argv[1]);
79-
# if (json.status == 202) {
80-
# json.status + ' as expected from /default';
81-
# } else {
82-
# console.log('Unexpected status from /default: ' + process.argv[1]);
83-
# process.exit(1);
84-
# }
85-
# " "${RESPONSE}"
67+
if echo "${VERSION}" | grep -qiE '(alpha|beta|rc|snapshot|milestone)'; then
68+
echo "Skipping setting ${VERSION} as default (pre-release version)"
69+
else
70+
echo "Setting ${VERSION} as a default"
71+
RESPONSE="$(curl -s -X PUT \
72+
-H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \
73+
-H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
74+
-H "Content-Type: application/json" \
75+
-H "Accept: application/json" \
76+
-d '{"candidate": "mvnd", "version": "'${VERSION}'"}' \
77+
https://vendors.sdkman.io/default)"
78+
79+
node -pe "
80+
var json = JSON.parse(process.argv[1]);
81+
if (json.status == 202) {
82+
json.status + ' as expected from /default';
83+
} else {
84+
console.log('Unexpected status from /default: ' + process.argv[1]);
85+
process.exit(1);
86+
}
87+
" "${RESPONSE}"
88+
fi
8689

8790
RELEASE_URL="https://dlcdn.apache.org/maven/mvnd/${VERSION}"
8891
echo "RELEASE_URL = $RELEASE_URL"

0 commit comments

Comments
 (0)