From 0131227c48f74f6f62dfca8fef9b2d5c31378235 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 26 Aug 2021 15:09:33 +0200 Subject: [PATCH] adds the new versions builder script --- versions.sh | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 versions.sh diff --git a/versions.sh b/versions.sh new file mode 100755 index 0000000..453f2fd --- /dev/null +++ b/versions.sh @@ -0,0 +1,94 @@ +#!/bin/bash +set -Eeuo pipefail + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +# you can pass the versions (of Joomla) to this file for the initial/re-build +versions=("$@") +if [ ${#versions[@]} -eq 0 ]; then + # get the folders from the current root directory of the project as the versions + # if no versions where passed to the file + # this is the standard (2021) way fo doing this + # see (https://github.com/docker-library/php/blob/master/versions.sh#L38) + versions=(*/) + # was assume the folders to be correct + # and will serve as the rule + # so the json is build from that + json='{}' +else + # with the initial/re-build the versions.json is manually set + json="$( $fullVersion" + echo "# PHP => $phpVersions" + echo "# sha512 => $sha512" + + # build this fullVersion matrix + # and add it to the JSON + json="$( + jq <<<"$json" -c \ + --argjson doc "$doc" \ + --argjson phpVersions "$phpVersions" \ + --argjson aliases "$aliases" \ + --argjson variants "$variants" \ + --arg defaultPHP "$defaultPHP" \ + --arg defaultVariant "$defaultVariant" ' + .[env.version] = { + version: env.fullVersion, + php: $defaultPHP, + phpVersions: $phpVersions, + variant: $defaultVariant, + variants: $variants, + aliases: $aliases, + } + $doc + ' + )" +done + +# store the JSON to the file system +jq <<<"$json" -S . >versions.json