mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-14 21:37:17 +00:00
Encforce tag descriptions in tfw.sh releasetfw
This commit is contained in:
parent
8e0537974e
commit
66be01548b
28
hack/tfw.sh
28
hack/tfw.sh
@ -39,7 +39,9 @@ release_baseimage()
|
||||
read -p "Tag and push new TFW version \"${TAG}\"? [y/N]" -r && echo
|
||||
if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]
|
||||
then
|
||||
TAG="$TAG" force_push_tag
|
||||
description=""
|
||||
prompt_for_tag_description # This command overwrites $description
|
||||
TAG="$TAG" DESCRIPTION="$description" force_push_tag
|
||||
fi
|
||||
}
|
||||
|
||||
@ -54,11 +56,33 @@ check_drone_releasename()
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_for_tag_description()
|
||||
{
|
||||
editor="$(git config --global core.editor)"
|
||||
tempfile="$(mktemp)"
|
||||
|
||||
printf "\n\n" >> "$tempfile"
|
||||
echo "# Please enter the description for this release." >> "$tempfile"
|
||||
echo "# Lines starting with '#' will be ignored." >> "$tempfile"
|
||||
echo "# An empty description aborts the release." >> "$tempfile"
|
||||
|
||||
$editor "$tempfile"
|
||||
sed -i -e 's/#.*$//' -e '/^$/d' "$tempfile"
|
||||
sed -i 's/\n/ /g' "$tempfile"
|
||||
if [[ ! -s "$tempfile" ]]; then
|
||||
echo "Aborting release due to empty description."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
description="$(tr '\n' ' ' < "$tempfile")"
|
||||
rm "$tempfile"
|
||||
}
|
||||
|
||||
force_push_tag()
|
||||
{
|
||||
git tag -d "$TAG" > /dev/null 2>&1 || :
|
||||
git push --delete origin "$TAG" > /dev/null 2>&1 || :
|
||||
git tag -s -m "TFW version $TAG released at $(date '+%H:%M:%S %Y-%m-%d')" "$TAG"
|
||||
git tag -s -m "$DESCRIPTION" "$TAG"
|
||||
git push origin "$TAG"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user