# test if xpi build works
# make -f debian/rules build
# make -f debian/rules clean

# this needs to be done only once, for setup
debcheckout -a torbirdy
cd torbirdy
git fetch origin
git checkout pristine-tar
git remote add torbirdy-upstream https://git.torproject.org/torbirdy.git
git fetch upstream

# This needs to be done everytime
git fetch origin
git fetch upstream

export VERSION="0.2.0"
# verify the tag's GPG signature
git verify-tag -v ${VERSION}

# checkout & export latest signed upstream tag (preferred)
git checkout debian/sid
uscan --download # this will also verify the XPI signature.
# or:
git checkout $VERSION
git archive --prefix="torbirdy-${VERSION}/" --output="../torbirdy_${VERSION}.orig.tar.gz" $VERSION

# in any case, now:
git checkout debian/sid
git clean -fdx

# Possibility1: Import the tarball (preferred)
gbp import-orig --upstream-vcs-tag=${VERSION} --pristine-tar "../torbirdy_${VERSION}.orig.tar.gz"

# Possibility2: Merge current release. Possibility 1 is preferred.
# git merge $VERSION

# Now update the changelog
dch -i
git commit debian/changelog

# build
gbp buildpackage
git tag -s debian/$VERSION-1
git push origin master && git push origin --tags
