diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 16e8b1c5f..485cbb5b0 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -16,6 +16,11 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" # add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh") latest="$(jq -r 'keys_unsorted[0]' versions.json)" aliases["$latest"]+=' latest' +# if "innovation" currently is in line with an LTS, add the "innovation" alias to the LTS release +innovation="$(jq -r 'to_entries | if .[0].value.version == .[1].value.version and .[1].key == "innovation" then .[0].key else "innovation" end' versions.json)" +if [ "$innovation" != 'innovation' ]; then + aliases["$innovation"]+=' innovation' +fi if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" diff --git a/versions.sh b/versions.sh index cb73b25ef..3b0823e97 100755 --- a/versions.sh +++ b/versions.sh @@ -177,10 +177,17 @@ jq <<<"$json" ' # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 to_entries | sort_by( - # very rough "sort by version number" - .value.version - | split(".") - | map(tonumber? // .) + [ + ( + # very rough "sort by version number" + .value.version + | split(".") + | map(tonumber? // .) + ), + # when two versions are equal (8.4.0 copied to "innovation" *and* in "8.4", for example), prefer the LTS/explicit release over "innovation" + .key != "innovation" + # (false sorts above true, but then we reverse) + ] ) | reverse | from_entries