Skip to content

Instantly share code, notes, and snippets.

@wyllie
Last active August 20, 2020 12:37
Show Gist options
  • Save wyllie/63c7050cc3c5d7808f0febd40a6c14f1 to your computer and use it in GitHub Desktop.
Save wyllie/63c7050cc3c5d7808f0febd40a6c14f1 to your computer and use it in GitHub Desktop.
python bumpversion and tag/create new github release
#!/usr/bin/env sh
# Quick little script that bumps the release version using `bump2version`
# and then creates a release using the github `hub` tool
# I added bump2version to the project's requirements.txt file
usage() {
echo "Usage: $0 [major|minor|patch]" 1>&2
}
options=('major' 'minor' 'patch')
if [[ " ${options[@]} " =~ " $1 " ]]; then
if [ -x /usr/local/bin/hub ]; then
echo Current Version: v$(python setup.py --version)
bumpversion $1
VERSION=v$(python setup.py --version)
echo New Version: $VERSION
git push
hub release create $VERSION
fi
else
usage
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment