#!/usr/bin/env bash # release process for almost all of the Debian packages I maintain set -e branch="$(git symbolic-ref HEAD | sed 's|refs/heads/||')" if ! (git diff-index --quiet --cached HEAD && \ git diff-files --quiet && \ test -z "$(git status --porcelain)" \ ) >/dev/null 2>&1; then echo >&2 "must commit first" exit 1 fi if [[ $branch =~ ^wip/ ]]; then echo >&2 "you don't want to upload a wip/ branch" exit 1 fi if [ "$(dpkg-parsechangelog -SDistribution)" = "UNRELEASED" ]; then debchange --release # pauses for user confirmation git commit --include debian/changelog \ -m"finalise changelog for $(dpkg-parsechangelog -SVersion) upload" fi # this is not a general test for whether a package is being maintained with # git-debrebase, but it will ensure the `dch -r` commit is behind the patch # queue in most cases if git show-ref | grep -q "refs/ffq-prev\\|refs/debrebase-last"; then git debrebase fi dgit push "$@" git push --follow-tags # # if origin is not salsa, we might also want to push to salsa # # (~/src/dotfiles/lib-src/mr/config should contain # # `git remote add -f salsa salsa:foo/bar` for this repo) # if git remote | grep -q salsa \ # && git branch --contains salsa/$branch \ # | grep -qE " $branch$"; then # git push --follow-tags salsa $branch:$branch # fi