-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·43 lines (39 loc) · 1.52 KB
/
update.sh
File metadata and controls
executable file
·43 lines (39 loc) · 1.52 KB
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
#!/bin/bash
releases=$(curl --retry 5 --retry-delay 10 -4 -vso- "https://www.php.net/releases/?json" 2>curl.log | tee curl.out | jq 'to_entries | .[] | select(if .value.supported_versions | length == 0 then .value.tags | index("security") else true end) | if .value.supported_versions | length == 0 then [.value.version[0:3]] else .value.supported_versions end' | jq -rs 'add | sort | reverse | join(" ")')
if [ -z "${releases}" ]; then
cat curl.log
cat curl.out
exit 1
else
rm -f curl.log
rm -f curl.out
fi
for release in $releases; do
version=$(curl --retry 5 --retry-delay 10 -4 -vso- "https://www.php.net/releases/?json&version=${release}" 2>curl.log | tee curl.out | jq -r '.version');
if [ -z "${version}" ]; then
cat curl.log
cat curl.out
exit 1
else
rm -f curl.log
rm -f curl.out
fi
echo -n "${version} -- "
docker manifest inspect php:$version 2>/dev/null 1>/dev/null || (c=$?; echo "no upstream docker image found"; exit $c) || continue
tag=$(git tag -l "${version}")
if [ -z "${tag}" ]; then
# create tag
git tag "${version}"
git push origin "${version}:${version}"
echo "added"
elif [ -z "$(git tag -l "${version}" --points-at HEAD)" ]; then
# update tag
git tag -d "${version}" > /dev/null
git push --delete origin "${version}"
git tag "${version}"
git push origin "${version}:${version}"
echo "updated"
else
echo "already up-to-date"
fi
done