fix: sort output

Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
matttrach 2026-04-09 16:12:54 -05:00
parent ecbc278ccf
commit a0f14bb582
No known key found for this signature in database
GPG key ID: E082F2592F87D4AE
2 changed files with 3491 additions and 3483 deletions

File diff suppressed because it is too large Load diff

View file

@ -35,9 +35,12 @@ fetch_checksums() {
return
fi
local clean_v=$(echo "$tag" | sed 's/^v//' | sed 's/-pro$//' | sed 's/~pro$//')
local major=$(echo "$clean_v" | cut -d. -f1 || echo "")
local minor=$(echo "$clean_v" | cut -d. -f2 || echo "")
local clean_v
local major
local minor
clean_v=$(echo "$tag" | sed 's/^v//' | sed 's/-pro$//' | sed 's/~pro$//')
major=$(echo "$clean_v" | cut -d. -f1 || echo "")
minor=$(echo "$clean_v" | cut -d. -f2 || echo "")
if [[ "$major" =~ ^[0-9]+$ ]] && [[ "$minor" =~ ^[0-9]+$ ]]; then
if [ "$major" -eq "$MIN_MAJOR" ] && [ "$minor" -lt "$MIN_MINOR" ]; then
@ -92,7 +95,7 @@ for tag in $PRO_TAGS; do
minor=$(echo "$clean_v" | cut -d. -f2 || echo "")
if [[ "$major" =~ ^[0-9]+$ ]] && [[ "$minor" =~ ^[0-9]+$ ]]; then
if [ "$major" -lt 2 ] || ( [ "$major" -eq 2 ] && [ "$minor" -lt 7 ] ); then
if [ "$major" -lt 2 ] || { [ "$major" -eq 2 ] && [ "$minor" -lt 7 ]; }; then
if [[ "$tag" != *"-pro" ]]; then
tag="${tag}-pro"
fi
@ -115,10 +118,15 @@ NEW_JSON=$(jq -n -R '
' < "$FLAT_FILE")
MERGED_JSON=$(echo "$EXISTING_JSON" | jq --argjson new "$NEW_JSON" '. * $new')
SORTED_JSON=$(echo "$MERGED_JSON" | jq -r 'keys[]' | sort -rV | jq -R . | jq -s 'map(select(length > 0))' | jq --argjson data "$MERGED_JSON" 'map({key: ., value: $data[.]}) | from_entries')
echo "// This file contains sha256 checksums of GoReleaser binaries." > "$OUT_FILE"
echo "// Auto-generated by update-checksums.sh" >> "$OUT_FILE"
echo -n "export const checksums: Record<string, Record<string, string>> = " >> "$OUT_FILE"
echo "$MERGED_JSON;" >> "$OUT_FILE"
rm -f "$OUT_FILE"
touch "$OUT_FILE"
{
echo "// This file contains sha256 checksums of GoReleaser binaries."
echo "// Auto-generated by update-checksums.sh"
echo -n "export const checksums: Record<string, Record<string, string>> = "
echo "$SORTED_JSON;"
} >> "$OUT_FILE"
echo -e "\nSuccessfully updated src/checksums.ts!"