Last active
July 10, 2017 04:59
-
-
Save kentaro-m/778fa8e607e89a8c56f568a56188051e to your computer and use it in GitHub Desktop.
This file contains 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 | |
commit_message=`git log --format=%B -n 1 ${CIRCLE_SHA1}` | |
if [[ $commit_message != "Merge"* ]] ; then | |
echo 'deploy skip [excluded build]'; | |
exit 0; | |
fi | |
pr_title=`curl -H "User-Agent: ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \ | |
-H "Authorization: token ${GH_TOKEN}" \ | |
"https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls?state=closed" | jq -r ".[0].title"` | |
echo $pr_title; | |
if [[ $pr_title == "fix:"* ]] ; then | |
echo 'release:patch'; | |
npm run release:patch || exit 1; | |
elif [[ $pr_title == "feat:"* ]] ; then | |
echo 'release:minor'; | |
npm run release:minor || exit 1; | |
elif [[ $pr_title == "perf:"* ]] ; then | |
echo 'release:major'; | |
npm run release:major || exit 1; | |
else | |
echo 'release failed'; | |
exit 1; | |
fi | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment