-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathversions.sh
More file actions
executable file
·45 lines (38 loc) · 1023 Bytes
/
versions.sh
File metadata and controls
executable file
·45 lines (38 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
json='{}'
else
json="$(< versions.json)"
fi
versions=( "${versions[@]%/}" )
defaultDebianSuite='trixie-slim'
declare -A debianSuite=(
)
defaultAlpineVersion='3.23'
declare -A alpineVersion=(
)
for version in "${versions[@]}"; do
export version
export url="https://www.haproxy.org/download/$version/src"
export debian="${debianSuite[$version]:-$defaultDebianSuite}"
export alpine="${alpineVersion[$version]:-$defaultAlpineVersion}"
doc="$(
curl -fsSL "$url/releases.json" | jq -c '
{ version: .latest_release } + .releases[.latest_release]
| {
version: .version,
url: (env.url + "/" + .file),
sha256: .sha256,
debian: env.debian,
alpine: env.alpine,
}
'
)"
jq <<<"$doc" -r 'env.version + ": " + .version'
json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = $doc')"
done
jq <<<"$json" -S . > versions.json