Skip to content

Instantly share code, notes, and snippets.

@azet
Last active August 29, 2015 14:08
Show Gist options
  • Save azet/0fdb98f759ccd5fd8759 to your computer and use it in GitHub Desktop.
Save azet/0fdb98f759ccd5fd8759 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if [ ! -f debian/changelog ]; then
echo "E: debian/changelog not found, aborting." >&2
exit 1
fi
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "This is a simple wrapper script; all arguments are passed on to git dch."
echo "Use git dch --help for help."
exit 0
fi
if [ ! -f debian/gbp.conf ]; then
echo "E: debian/gbp.conf not found, repository probably not set up correctly." >&2
exit 1
fi
changes=$(git status --porcelain)
if [ -n "$changes" ]; then
git status
echo
echo "E: Working directory is not clean. Please commit or stash your changes first." >&2
exit 1
fi
branchinfo=$(git status -b --porcelain)
if [ "${branchinfo:3:8}" != "master.." ]; then
echo "E: Refusing to work on another branch than master." >&2
exit 1
fi
export DEB_VENDOR=debian
echo "Generating changelog..."
git dch --release --commit "$@"
echo "Tagging using git-buildpackage..."
git-buildpackage --git-tag --git-tag-only
echo "Done. Don't forget to push the tag!"
echo "Example:"
echo " git push --tags && git push"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment