Merge pull request #6 from Luexa/improved-tagged-release-retrieval

Improve method of retrieving tagged releases
This commit is contained in:
Mitchell Hashimoto 2022-10-31 21:41:22 -07:00 committed by GitHub
commit 5c97a216f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 18 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
sources.old.json
sources.new.json
sources.new2.json

14
update
View file

@ -17,9 +17,10 @@ def toentry(vsn; x):
"version": $version,
}
}
)] | add;
)] | add | first(values, {});
to_entries[] | {
reduce to_entries[] as $entry ({}; . * (
$entry | {
(.key): (
if (.key != "master") then
toentry(.key; .value)
@ -28,13 +29,10 @@ to_entries[] | {
(.value.date): toentry(.value.version; .value),
} end
)
}
}
))
' > sources.new.json
# Merge all of the objects from the previous step. Maybe there is a way
# to do this in one command (probably), but I don't know how!
jq -s add sources.new.json > sources.new2.json
# For debugging
# cat sources.new.json
# exit
@ -43,4 +41,4 @@ jq -s add sources.new.json > sources.new2.json
cp sources.json sources.old.json
# Recursive merge
jq -s '.[0] * .[1]' sources.old.json sources.new2.json > sources.json
jq -s '.[0] * .[1]' sources.old.json sources.new.json > sources.json