1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 21:57:17 +00:00

Implement drone releasename checking

This commit is contained in:
Kristóf Tóth 2018-04-16 16:56:54 +02:00
parent 1192f4c9da
commit 18719f5f97

View File

@ -33,6 +33,8 @@ release_baseimage()
{ {
[ ! -d "$BASEIMAGE_PATH" ] && return || : [ ! -d "$BASEIMAGE_PATH" ] && return || :
cd $BASEIMAGE_PATH cd $BASEIMAGE_PATH
check_drone_releasename
TAG="$(baseimage_releasename)" TAG="$(baseimage_releasename)"
read -p "Tag and push new TFW version \"${TAG}\"? [y/N]" -r && echo read -p "Tag and push new TFW version \"${TAG}\"? [y/N]" -r && echo
if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]] if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]
@ -42,6 +44,17 @@ release_baseimage()
fi 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() baseimage_releasename()
{ {
VERSION="$(cat VERSION | head -n 1)" VERSION="$(cat VERSION | head -n 1)"