@@ -14,7 +14,6 @@ project_root="$( cd -P "$( dirname "$source" )/.." && pwd )"
1414
1515revision=" $( mvn -f " ${project_root} /pom.xml" help:evaluate -Dexpression=revision -q -DforceStdout) "
1616revision=" ${revision% -SNAPSHOT} " # remove -SNAPSHOT
17- revision_quoted_for_jq=" ${revision// ./ \\\\ .} "
1817
1918echo " Trying to find the release for revision: ${revision} "
2019curl -sSL " https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/releases" -o github_releases.json
@@ -23,12 +22,28 @@ echo "Downloaded releases JSON from GitHub, head:"
2322head -n 20 github_releases.json
2423echo " ==========================================="
2524
26- asset_url=$( cat github_releases.json \
27- | jq -r ' map(select(.tag_name | test("' ${revision_quoted_for_jq} ' "))) | max_by(.published_at) | .assets[] | select(.name | test("^maven-resource-.*\\.zip$")) | .browser_download_url' )
25+ # Find the newest maven-resource-bundle ZIP whose name contains the desired revision.
26+ # Scan all releases and their assets, guard against nulls, and pick the latest by published_at.
27+ asset_url=$(
28+ jq -r --arg rev " $revision " '
29+ [ .[] as $rel
30+ | ($rel.assets // [])[]
31+ | select(
32+ (.name | startswith("maven-resource-bundle-")) and
33+ (.name | contains($rev)) and
34+ (.name | endswith(".zip"))
35+ )
36+ | {published_at: $rel.published_at, url: .browser_download_url}
37+ ]
38+ | sort_by(.published_at)
39+ | last?
40+ | .url // empty
41+ ' github_releases.json
42+ )
2843
2944rm github_releases.json
3045if [[ -z " $asset_url " ]]; then
31- echo " Failed to find a maven-resource-bundle zip" >&2
46+ echo " Failed to find a maven-resource-bundle zip for revision ${revision} " >&2
3247 exit 1
3348fi
3449echo $asset_url
0 commit comments