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)"