2016-10-08 08:31:44 +02:00
|
|
|
#!/bin/bash
|
2017-06-07 18:45:56 +02:00
|
|
|
# This script gets the latest GitHub releases for the specified projects.
|
2016-10-08 08:31:44 +02:00
|
|
|
set -e
|
2017-04-27 22:58:43 +02:00
|
|
|
set -o pipefail
|
2016-10-08 08:31:44 +02:00
|
|
|
|
|
|
|
if [[ -z "$GITHUB_TOKEN" ]]; then
|
|
|
|
echo "Set the GITHUB_TOKEN env variable."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
URI=https://api.github.com
|
|
|
|
API_VERSION=v3
|
|
|
|
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
|
|
|
|
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
|
|
|
|
|
|
|
|
get_latest() {
|
|
|
|
local repo=$1
|
|
|
|
|
|
|
|
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/releases/latest")
|
|
|
|
local tag=$(echo $resp | jq --raw-output .tag_name)
|
|
|
|
local name=$(echo $resp | jq --raw-output .name)
|
|
|
|
|
|
|
|
if [[ "$tag" == "null" ]]; then
|
|
|
|
# get the latest tag
|
|
|
|
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/tags")
|
|
|
|
local tag=$(echo $resp | jq --raw-output .[0].name)
|
|
|
|
fi
|
|
|
|
|
2016-12-28 02:04:58 +01:00
|
|
|
if [[ "$name" == "null" ]] || [[ "$name" == "" ]]; then
|
2016-12-28 01:34:48 +01:00
|
|
|
name="-"
|
|
|
|
fi
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
local dir=${repo#*/}
|
2016-12-28 01:10:07 +01:00
|
|
|
|
|
|
|
if [[ "$dir" == "CouchPotatoServer" ]]; then
|
2016-12-28 02:04:58 +01:00
|
|
|
dir="couchpotato"
|
|
|
|
elif [[ "$dir" == "SoftHSMv2" ]]; then
|
|
|
|
dir="golang-softhsm2"
|
2017-02-12 19:25:18 +01:00
|
|
|
elif [[ "$dir" == "bazel" ]]; then
|
|
|
|
dir="gitiles"
|
2017-03-22 20:29:18 +01:00
|
|
|
elif [[ "$dir" == "oauth2_proxy" ]]; then
|
|
|
|
dir="oauth2-proxy"
|
2016-12-28 01:10:07 +01:00
|
|
|
fi
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
local current=$(cat "${dir}/Dockerfile" | grep -m 1 VERSION | awk '{print $(NF)}')
|
|
|
|
|
2017-06-05 23:02:36 +02:00
|
|
|
if [[ "$tag" =~ "$current" ]] || [[ "$name" =~ "$current" ]] || [[ "$current" =~ "$tag" ]] || [[ "$current" == "master" ]]; then
|
2016-10-08 08:31:44 +02:00
|
|
|
echo -e "\e[36m${dir}:\e[39m current ${current} | ${tag} | ${name}"
|
|
|
|
else
|
2017-06-11 02:30:01 +02:00
|
|
|
if [[ "$dir" != "zookeeper" ]]; then
|
2017-06-05 23:02:36 +02:00
|
|
|
bad_versions+=( "${dir}" )
|
|
|
|
fi
|
2016-10-08 08:31:44 +02:00
|
|
|
echo -e "\e[31m${dir}:\e[39m current ${current} | ${tag} | ${name} | https://github.com/${repo}/releases"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
projects=(
|
|
|
|
atom/atom
|
|
|
|
camlistore/camlistore
|
2017-01-06 02:31:45 +01:00
|
|
|
certbot/certbot
|
2016-12-28 02:04:58 +01:00
|
|
|
hashicorp/consul
|
2016-12-28 01:10:07 +01:00
|
|
|
CouchPotato/CouchPotatoServer
|
2016-12-28 02:04:58 +01:00
|
|
|
pooler/cpuminer
|
2016-10-08 08:31:44 +02:00
|
|
|
curl/curl
|
2016-12-28 02:04:58 +01:00
|
|
|
opendnssec/SoftHSMv2
|
2017-03-24 18:39:31 +01:00
|
|
|
google/guetzli
|
2016-10-08 08:31:44 +02:00
|
|
|
irssi/irssi
|
2017-06-11 02:30:01 +02:00
|
|
|
keepassxreboot/keepassxc
|
2016-12-28 02:04:58 +01:00
|
|
|
zyedidia/micro
|
2017-03-22 20:29:18 +01:00
|
|
|
bitly/oauth2_proxy
|
2016-10-08 08:31:44 +02:00
|
|
|
JonnyWong16/plexpy
|
|
|
|
powershell/powershell
|
|
|
|
ricochet-im/ricochet
|
2016-12-28 02:04:58 +01:00
|
|
|
reverse-shell/routersploit
|
2016-10-08 08:31:44 +02:00
|
|
|
tarsnap/tarsnap
|
2016-12-28 02:04:58 +01:00
|
|
|
fcambus/telize
|
|
|
|
mitchellh/vagrant
|
|
|
|
hashicorp/vault
|
|
|
|
facebook/watchman
|
2017-06-11 02:30:01 +02:00
|
|
|
wireguard/wireguard
|
2016-10-08 08:31:44 +02:00
|
|
|
znc/znc
|
2016-12-28 02:04:58 +01:00
|
|
|
apache/zookeeper
|
2016-10-08 08:31:44 +02:00
|
|
|
)
|
|
|
|
|
2017-06-05 23:02:36 +02:00
|
|
|
bad_versions=()
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
main() {
|
|
|
|
for p in ${projects[@]}; do
|
|
|
|
get_latest "$p"
|
|
|
|
done
|
2017-06-05 23:02:36 +02:00
|
|
|
|
|
|
|
if [[ ${#bad_versions[@]} -ne 0 ]]; then
|
|
|
|
echo
|
|
|
|
echo "These Dockerfiles are not up to date: ${bad_versions[@]}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-08 08:31:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|