only clobber sha256 on master to avoid redownloading all releases

This commit is contained in:
Mitchell Hashimoto 2023-01-17 11:06:12 -08:00
parent fb815becf7
commit 5e2c50cbca
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC

17
update
View file

@ -6,16 +6,19 @@ set -e
curl -s 'https://ziglang.org/download/index.json' | jq ' curl -s 'https://ziglang.org/download/index.json' | jq '
["aarch64-linux", "x86_64-linux", "aarch64-macos", "x86_64-macos", "aarch64-windows", "x86_64-windows"] as $targets | ["aarch64-linux", "x86_64-linux", "aarch64-macos", "x86_64-macos", "aarch64-windows", "x86_64-windows"] as $targets |
def todarwin(x): x | gsub("macos"; "darwin"); def todarwin(x): x | gsub("macos"; "darwin");
def toentry(vsn; x): def toentry(vsn; x; clobber_sha):
[(vsn as $version | [(vsn as $version |
.value | .value |
to_entries[] | to_entries[] |
select(.key as $key | any($targets[]; . == $key)) | { select(.key as $key | any($targets[]; . == $key)) | {
(todarwin(.key)): { (todarwin(.key)): ({
"url": .value.tarball, "url": .value.tarball,
"sha256": .value.shasum,
"version": $version, "version": $version,
} } + (if (clobber_sha) then
{ "sha256": .value.shasum }
else
{}
end))
} }
)] | add | first(values, {}); )] | add | first(values, {});
@ -23,10 +26,10 @@ reduce to_entries[] as $entry ({}; . * (
$entry | { $entry | {
(.key): ( (.key): (
if (.key != "master") then if (.key != "master") then
toentry(.key; .value) toentry(.key; .value; false)
else { else {
"latest": toentry(.value.version; .value), "latest": toentry(.value.version; .value; true),
(.value.date): toentry(.value.version; .value), (.value.date): toentry(.value.version; .value; true),
} end } end
) )
} }