summaryrefslogtreecommitdiff
path: root/bin/debrel
blob: 1aca841767a32cd81580299a5abf794d6e1504a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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