Automate GA releases and tag alias updates ("1", "latest", "rc")

This commit is contained in:
Tianon Gravi 2023-12-27 13:01:59 -08:00
parent 0ad271250b
commit efffdccb75
4 changed files with 51 additions and 9 deletions

View File

@ -39,6 +39,11 @@ for version; do
rm -rf "$version/"
if jq -e '.[env.version] | not' versions.json > /dev/null; then
echo "deleting $version ..."
continue
fi
variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)"
eval "variants=( $variants )"

View File

@ -1,11 +1,6 @@
#!/usr/bin/env bash
set -Eeuo pipefail
declare -A aliases=(
[1.9]='1 latest'
[1.10-rc]='rc'
)
self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
@ -74,19 +69,42 @@ join() {
echo "${out#$sep}"
}
declare -A latest=(
#[1]='1.9'
#[latest]='1.9'
#[rc]='1.10-rc'
)
for version; do
export version
if ! fullVersion="$(jq -er '.[env.version] | if . then .version else empty end' versions.json)"; then
continue
fi
variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)"
eval "variants=( $variants )"
fullVersion="$(jq -r '.[env.version].version' versions.json)"
versionAliases=(
$fullVersion
$version
${aliases[$version]:-}
)
aliases=()
if [ "$version" = "${version%-rc}" ]; then
if [[ "$version" =~ [0-9]+[.][0-9]+ ]]; then
aliases+=( "${version%%.*}" latest ) # "1", "latest"
fi
else
aliases+=( rc )
fi
for a in "${aliases[@]}"; do
if [ -z "${latest[$a]:-}" ]; then
latest[$a]="$version"
versionAliases+=( "$a" )
fi
done
defaultDebianVariant="$(jq -r '
.[env.version].variants
| map(select(

View File

@ -1,4 +1,5 @@
{
"1.10": null,
"1.10-rc": {
"arches": {
"alpine-amd64": {

View File

@ -69,7 +69,8 @@ juliaVersions="$(
)"
for version in "${versions[@]}"; do
export version
rcVersion="${version%-rc}"
export version rcVersion
if \
! doc="$(jq <<<"$juliaVersions" -c '
@ -84,6 +85,18 @@ for version in "${versions[@]}"; do
echo "$version: $fullVersion"
if [ "$rcVersion" != "$version" ] && gaFullVersion="$(jq <<<"$json" -er '.[env.rcVersion] | if . then .version else empty end')"; then
# Julia pre-releases have always only been for .0, so if our pre-release now has a relevant GA, it should go away 👀
# $ wget -qO- 'https://julialang-s3.julialang.org/bin/versions.json' | jq 'keys_unsorted[]' -r | grep -E '[^0]-'
# just in case, we'll also do a version comparison to make sure we don't have a pre-release that's newer than the relevant GA
latestVersion="$({ echo "$fullVersion"; echo "$gaFullVersion"; } | sort -V | tail -1)"
if [[ "$fullVersion" == "$gaFullVersion"* ]] || [ "$latestVersion" = "$gaFullVersion" ]; then
# "x.y.z-rc1" == x.y.z*
json="$(jq <<<"$json" -c 'del(.[env.version])')"
continue
fi
fi
json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = (
$doc
| del(.major)
@ -102,6 +115,11 @@ for version in "${versions[@]}"; do
else empty end
])
)')"
# make sure pre-release versions have a placeholder for GA
if [ "$version" != "$rcVersion" ]; then
json="$(jq <<<"$json" -c '.[env.rcVersion] //= null')"
fi
done
jq <<<"$json" -S . > versions.json