diff --git a/bin/bump-version b/bin/bump-version new file mode 100755 index 00000000..e1521fee --- /dev/null +++ b/bin/bump-version @@ -0,0 +1,28 @@ +#!/bin/bash + +usage() { echo "Usage: $0 -p [major | minor | patch]" 1>&2; exit 1; } + +while getopts "p:" o; do + case "${o}" in + p) + patch_level=${OPTARG} + (( patch_level == 'major' || patch_level == 'minor' || patch_level == 'patch')) + ;; + *) + usage + ;; + esac +done + +echo "$patch_level" + +if [[ -z "${patch_level}" ]]; then + usage +fi + +new_version=$(npm version "${patch_level}" --no-git-tag-version) +git checkout -b "${new_version}"-release-notes +git add package.json package-lock.json +git commit -m "${new_version}" + +echo "Branch prepared for ${new_version}"