From 0c746730ae2da2e94f482c08f503e5845f323a50 Mon Sep 17 00:00:00 2001 From: pierreozoux Date: Fri, 2 Sep 2016 14:11:38 +0100 Subject: [PATCH] Adds some automation --- generate-stackbrew-library.sh | 16 ++++++++++++++++ update.sh | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 generate-stackbrew-library.sh create mode 100755 update.sh diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh new file mode 100755 index 00000000..bf54f977 --- /dev/null +++ b/generate-stackbrew-library.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +url='git://github.com/nextcloud/docker' + +commit="$(git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))" +fullVersion="$(grep -m1 'ENV NEXTCLOUD_VERSION ' ./Dockerfile | cut -d' ' -f3)" + +echo '# maintainer: docker@nextcloud.com' +echo +echo "$fullVersion: ${url}@${commit}" +echo "${fullVersion%.*}: ${url}@${commit}" +echo "${fullVersion%.*.*}: ${url}@${commit}" +echo "latest: ${url}@${commit}" diff --git a/update.sh b/update.sh new file mode 100755 index 00000000..e5d0424b --- /dev/null +++ b/update.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -eo pipefail + +current="$( + git ls-remote --tags https://github.com/nextcloud/server.git \ + | awk -F 'refs/tags/' ' + $2 ~ /^v?[0-9]/ { + gsub(/^v|\^.*/, "", $2); + print $2; + } + ' \ + | sort -uV \ + | tail -1 +)" + +set -x +sed -ri 's/^(ENV NEXTCLOUD_VERSION) .*/\1 '"$current"'/;' ./Dockerfile