From 18719f5f9762ddff069c73c01076d424d7dfa9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 16 Apr 2018 16:56:54 +0200 Subject: [PATCH] Implement drone releasename checking --- hack/tfw.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hack/tfw.sh b/hack/tfw.sh index 5d11507..d2921c0 100755 --- a/hack/tfw.sh +++ b/hack/tfw.sh @@ -33,6 +33,8 @@ release_baseimage() { [ ! -d "$BASEIMAGE_PATH" ] && return || : cd $BASEIMAGE_PATH + check_drone_releasename + TAG="$(baseimage_releasename)" read -p "Tag and push new TFW version \"${TAG}\"? [y/N]" -r && echo if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]] @@ -42,6 +44,17 @@ release_baseimage() fi } +check_drone_releasename() +{ + DRONEYML_RELEASENAME="$(grep -oP '(?<=branch:\srefs/tags/).+(?=-.+)' .drone.yml)" + ACTUAL_RELEASENAME="$(baseimage_releasename | grep -oP ".+(?=-\d{8})")" + if [ "$DRONEYML_RELEASENAME" != "$ACTUAL_RELEASENAME" ]; then + echo "Release name '${DRONEYML_RELEASENAME}' in .drone.yml does not match actual release name '${ACTUAL_RELEASENAME}' in VERSION." + echo "Please make them match before releasing!" + exit 1 + fi +} + baseimage_releasename() { VERSION="$(cat VERSION | head -n 1)"