Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ function get_latest_released_version() {
group_id_url_path="$(sed 's|\.|/|g' <<< "${group_id}")"
url="https://repo1.maven.org/maven2/${group_id_url_path}/${artifact_id}/maven-metadata.xml"
xml_content=$(curl -s --fail "${url}")
latest=$(xmllint --xpath 'metadata/versioning/latest/text()' - <<< "${xml_content}")

# 1. Extract all version tags
# 2. Strip the XML tags to leave just the version numbers
# 3. Filter for strictly numbers.numbers.numbers (e.g., 2.54.0)
# 4. Sort by version (V) and take the last one (tail -n 1)
latest=$(echo "${xml_content}" \
| grep -oE '<version>[0-9]+\.[0-9]+\.[0-9]+</version>' \
| sed -E 's/<[^>]+>//g' \
| sort -V \
| tail -n 1)

if [[ -z "${latest}" ]]; then
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned json from maven.org is invalid: ${json_content}"
Expand Down Expand Up @@ -174,4 +184,4 @@ if [ -z "${pr_num}" ]; then
else
git push
gh pr edit "${pr_num}" --title "${title}" --body "${title}"
fi
fi
Loading