-
Notifications
You must be signed in to change notification settings - Fork 56
/
generate-stackbrew-library.sh
executable file
·75 lines (63 loc) · 1.91 KB
/
generate-stackbrew-library.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -e
# we want the current latest version, one minor version before that
# and the last version before a major version bump
aliases=(
'latest -> 6.12.0.182'
'6.12.0 -> 6.12.0.182'
'6.12 -> 6.12.0.182'
'6.10.0 -> 6.10.0.104'
'6.10 -> 6.10.0.104'
'6.8.0 -> 6.8.0.123'
'6.8 -> 6.8.0.123'
'6.6.0 -> 6.6.0.161'
'6.6 -> 6.6.0.161'
'6.4.0 -> 6.4.0.198'
'6.4 -> 6.4.0.198'
'6 -> 6.12.0.182'
'5.20.1 -> 5.20.1.34'
'5.20 -> 5.20.1.34'
'5.18.1 -> 5.18.1.28'
'5.18 -> 5.18.1.28'
'5 -> 5.20.1.34'
)
cd "$(dirname "${BASH_SOURCE[0]}")"
versions=( $( ls -d */ | sort -r))
versions=( "${versions[@]%/}" )
echo '# this file is generated via https://github.com/mono/docker/blob/main/generate-stackbrew-library.sh'
echo
echo 'Maintainers: Jo Shields <[email protected]> (@directhex),'
echo ' Alexander Köplinger <[email protected]> (@akoeplinger)'
echo 'GitRepo: https://github.com/mono/docker.git'
for version in "${versions[@]}"; do
variants=('')
if [ -d $version/slim ]; then
variants+=('-slim')
fi
for variant in "${variants[@]}"; do
commit="$(git log -1 --format='format:%H' -- "$version${variant/-//}")"
versionAliases=( $version )
for index in "${aliases[@]}"; do
if [[ "${index##* -> }" == "$version" ]]; then
versionAliases+=(${index%% *-> *})
fi
done
tags=""
for alias in "${versionAliases[@]}"; do
if [[ "$alias" == "latest" ]] && [[ "$variant" == "-slim" ]]; then # latest-slim should just be slim
tags="${tags}slim"
else
tags="${tags}${alias}${variant}"
fi
tags="${tags}, "
done
tags="${tags%, }"
architectures="amd64, i386, arm32v7, arm32v5, arm64v8, ppc64le"
echo
echo "Tags: $tags"
echo "Architectures: $architectures"
echo "GitFetch: refs/heads/main"
echo "GitCommit: ${commit}"
echo "Directory: $version${variant/-//}"
done
done