Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions generate-stackbrew-library.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"Maintainers: Tianon Gravi <[email protected]> (@tianon)",
"GitRepo: https://github.com/tianon/docker-postgres-upgrade.git",
"GitCommit: \($commit)",

(
first(.[].new) as $newest

| to_entries[]

| if $ARGS.positional | length > 0 then
select(IN(.key; $ARGS.positional[]))
else . end

| (
"",
"Tags: \(.key)",
"Directory: \(.key)",
"Architectures: \(
if .value.new == $newest then
# only the newest (target) version gets more than one architecture
# https://github.com/tianon/docker-postgres-upgrade/issues/99#issuecomment-3235566575
"amd64, arm64v8"
# TODO update "versions.sh" to also scrape/keep "Architectures" data from the upstream bashbrew files so this doesn't ever accidentally include things that don't exist or shouldn't be supported
else "amd64" end
)",
empty
)
)
27 changes: 6 additions & 21 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
#!/usr/bin/env bash
set -Eeuo pipefail

self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

if [ "$#" -eq 0 ]; then
versions="$(jq -r 'keys_unsorted | map(@sh) | join(" ")' versions.json)"
eval "set -- $versions"
fi

commit="$(git log -1 --format='format:%H' HEAD)"

cat <<-EOH
Maintainers: Tianon Gravi <[email protected]> (@tianon)
GitRepo: https://github.com/tianon/docker-postgres-upgrade.git
GitCommit: $commit
EOH

for version; do
export version

cat <<-EOE

Tags: $version
Directory: $version
EOE
done
exec jq \
--raw-output \
--arg commit "$commit" \
--from-file generate-stackbrew-library.jq \
versions.json \
--args -- "$@"
Loading