Commit fe8d2dd1 authored by Aral Balkan's avatar Aral Balkan
Browse files

Added a default tag message based on the last git commit message to the...

Added a default tag message based on the last git commit message to the deployment script (after finding myself copying and pasting it every time).
parent bcf5bf86
......@@ -40,8 +40,45 @@ gitTagLabel="${dateStamp}-${formattedCurrentDayDeploymentCount}"
echo "Git tag label: ${gitTagLabel}"
# Create a default tag message based on the last commit message.
mkdir -p tempTagMessageDirectory
# Not sure if there’s an easier way to get this.
gitDefaultEditor=$(git config -l | grep core.editor | perl -pe 's|^core.editor=||')
lastCommitMessage=$(git log -1 --oneline | perl -pe 's|^.*? ||')
echo "$lastCommitMessage" > "$tempTagMessageFilePath"
# Write out some instructions (so that it also resembles what people normally
# see when git opens up the editor. With an additional line of instructions on
# how to abort the tag.)
echo "\n#\n# Write a message for tag:\n#\t${gitTagLabel}\n# Lines starting with '#' will be ignored.\n#\n# If you’re happy with the default message above, just close this document.\n#\n# To abort deployment, delete all content and save the empty document." >> "$tempTagMessageFilePath"
# Create and open a temporary file to hold the message to pass to git tag later.
$gitDefaultEditor "$tempTagMessageFilePath"
emptyStringMD5=$(md5 -q -s '')
tagMessageMD5=$(md5 -q "$tempTagMessageFilePath")
# Check for empty tag message (this signals that the deployment should be aborted).
if [ "$emptyStringMD5" = "$tagMessageMD5" ]; then
# Person deleted the tag message, abort the tag.
echo "\nAborting deployment due to empty tag message.\n"
exit 1
echo "\n"
cat "$tempTagMessageFilePath"
echo "\n"
# Create the git tag
git tag -s "$gitTagLabel"
git tag -s "$gitTagLabel" --file="$tempTagMessageFilePath"
# Push the git tags
git push live --tags
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment