# 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 torbirdy-upstream

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

export VERSION="0.2.0"
# checkout latest signed upstream tag
git checkout $VERSION
git archive --prefix="torbirdy-${VERSION}/" --output="../torbirdy_${VERSION}.orig.tar.gz" $VERSION

# Possibility2: merge current release
git checkout debian/sid
git merge $VERSION

# if we want to import the tarball. no-merge does not merge twice into debian branch
gbp import-orig --no-merge --upstream-vcs-tag=0.2.0 --pristine-tar "../torbirdy_${VERSION}.orig.tar.gz"

dch -i
git commit debian/changelog

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