forked from CircleCI-Public/cimg-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgresFeed.sh
executable file
·64 lines (54 loc) · 1.87 KB
/
postgresFeed.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
#!/usr/bin/env bash
vers=()
if [ -f shared/automated-updates.sh ]; then
source shared/automated-updates.sh
else
echo "Check if submodule was loaded; automated-updates.sh is missing"
exit 1
fi
continueRelease() {
local version=$1
if ! eval grep -q "v$version" releases.txt; then
echo "Release $version not ready"
exit 0
fi
}
getPostGISVersion() {
local templateFile=$1
RSS_URL="https://github.com/postgis/postgis/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
for version in $VERSIONS; do
if [[ $version =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
generateVersions "$version"
generateSearchTerms "POSTGIS_VER=" "$templateFile" ""
replaceVersions "POSTGIS_VER=" "$SEARCH_TERM" true
fi
done
}
getPostgresVersion() {
EOL_VERSION=11
echo "Getting latest PostGIS version..."
getPostGISVersion "variants/postgis.Dockerfile.template"
echo "Getting postgres release list..."
curl -s https://ftp.postgresql.org/pub/source/ > releases.txt
RSS_URL="https://github.com/postgres/postgres/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
for version in $VERSIONS; do
if [[ $version =~ ^REL_[0-9]+(\_[0-9]+)*$ && $(echo "$version" | awk -F '_' '{print $2}') -gt "$EOL_VERSION" ]]; then
generateVersions "$(echo "$version" | sed -r 's/REL_//g; s/_/./g')"
generateSearchTerms "PG_VER=" "$majorMinor/Dockerfile" ""
directoryCheck "$majorMinor" "$SEARCH_TERM" true
continueRelease "$newVersion"
fi
done
}
getPostgresVersion
if [ -n "${vers[*]}" ]; then
rm -rf releases.txt
echo "Included version updates: ${vers[*]}"
echo "Running release script"
./shared/release.sh "${vers[@]}"
else
echo "No new version updates"
exit 0
fi