Skip to content

Instantly share code, notes, and snippets.

@SpainTrain
Created October 9, 2015 20:08
Show Gist options
  • Save SpainTrain/d4122936beec0da4639c to your computer and use it in GitHub Desktop.
Save SpainTrain/d4122936beec0da4639c to your computer and use it in GitHub Desktop.
bash script to check for release directive and bump, tag, and publish to npm
#!/bin/bash
set -ex
git config --global user.email "[email protected]"
git config --global user.name "CI"
git config --global push.default simple
LAST_COMMIT_MSG="$(git log -1 --pretty=%B)"
SEMVER_BUMP_TYPE="$(echo ${LAST_COMMIT_MSG} | sed -n 's/^.*[rR]elease v+\([a-z]\+\).*$/\1/p')"
if [ -n "${SEMVER_BUMP_TYPE}" ]; then
npm version ${SEMVER_BUMP_TYPE} -m ":arrow_up: CircleCI: Releasing %s"
git push
git push --tags
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment