Skip to content

Instantly share code, notes, and snippets.

@kentaro-m
Last active July 10, 2017 04:59
Show Gist options
  • Save kentaro-m/778fa8e607e89a8c56f568a56188051e to your computer and use it in GitHub Desktop.
Save kentaro-m/778fa8e607e89a8c56f568a56188051e to your computer and use it in GitHub Desktop.
#!/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