Skip to content

Commit

Permalink
Add a bump-version script
Browse files Browse the repository at this point in the history
  • Loading branch information
brrygrdn committed Feb 22, 2022
1 parent 3b13269 commit cf742d5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bin/bump-version
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit cf742d5

Please sign in to comment.