# Clean previous build
git clean -fdx

# Preferred way of updating this package.
uscan --download
export NEW_UPSTREAM_VERSION=1.3
export PKG_NAME=onionshare
export PACKAGING_BRANCH=debian
git checkout "$PACKAGING_BRANCH"
export UPSTREAM_BRANCH=`gbp config buildpackage.upstream-branch | sed -r -e 's,.*=,,'`

# Import
git merge $NEW_UPSTREAM_VERSION
gbp import-orig \
  --upstream-vcs-tag="v$NEW_UPSTREAM_VERSION" \
  ../${PKG_NAME}_${NEW_UPSTREAM_VERSION}.orig.tar.gz

gbp dch && dch -e
git commit debian/changelog -m "$(head -n 1 debian/changelog | sed -e 's,).*,),')
gbp buildpackage

gbp buildpackage --git-tag-only --git-sign-tags && \
git push --tags origin "$UPSTREAM_BRANCH" \
  "$PACKAGING_BRANCH" \
  pristine-tar
