Skip to content

Instantly share code, notes, and snippets.

@mseijas
Created October 18, 2016 19:31
Show Gist options
  • Save mseijas/728f81868569480062ca101be09391c8 to your computer and use it in GitHub Desktop.
Save mseijas/728f81868569480062ca101be09391c8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# fail if any commands fails
set -e
# debug log
# set -x
export push="true"
export tag=$APP_VERSION_WITH_PRE_RELEASE_INFO
export tag_message=$APP_VERSION_WITH_PRE_RELEASE_INFO
if [ -n "${push}" -a "${push}" == "true" -o "${push}" == "false" ]
then
git tag -a ${tag} -m "${tag_message}"
if [ "${push}" == "true" ]; then
git push origin ${tag}
fi
if (( $? )); then
echo "Failure" >&2
exit 1
else
echo "Success, new tags are :"
echo "$(git tag)"
# code block that is dependent on success of previous command
fi
exit 0
else
echo "push variable is required and could only be set to true or false"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment