Forked from merltron-pa/github_article_sample_cd_workflow__entrypoint.sh
Created
March 11, 2021 20:22
-
-
Save Sonic0/045041d4bcc3ffb227bc80c86243cf87 to your computer and use it in GitHub Desktop.
Example workflow used in this article: https://medium.com/@merlin.pav/122c653c0b09?source=friends_link&sk=4ca7d4ab89ce41f2118a1d9aad50807d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
echo "Start validation $1" | |
BRANCH=$(git branch -r --contains ${GITHUB_SHA} | grep "") | |
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g" | sed -e "s/\//-/g") | |
MASTER_BRANCH_NAME='origin/master' | |
RELEASE_PREFIX='r-' | |
if [[ "${INPUT_PRERELEASE}" != true ]] && [[ "$BRANCH" == *"$MASTER_BRANCH_NAME"* ]] && [[ "$RELEASE_VERSION" == "$RELEASE_PREFIX"* ]]; then | |
echo "Release tag validation succeeded!" | |
exit 0 | |
elif [[ "${INPUT_PRERELEASE}" == true ]]; then | |
echo "Pre-Release tag validation succeeded!" | |
exit 0 | |
else | |
echo "Tag validation failed!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment