1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:31:33 +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 || :
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)"