summaryrefslogtreecommitdiff
path: root/bin/debrel
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-07-15 10:47:29 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-07-15 10:47:29 -0700
commitabadd211438620723af1fff0fcdf71688297cb3d (patch)
treebe640e4bc097b4ac7a509e4012eb7a71262481f7 /bin/debrel
parent27c1409aea084eb3df73acbcdf30269f53deba65 (diff)
downloaddotfiles-abadd211438620723af1fff0fcdf71688297cb3d.tar.gz
make debrel a script, not just a .bashrc function
So can call from outside of bash.
Diffstat (limited to 'bin/debrel')
-rwxr-xr-xbin/debrel35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/debrel b/bin/debrel
new file mode 100755
index 00000000..090f045e
--- /dev/null
+++ b/bin/debrel
@@ -0,0 +1,35 @@
+#!/bin/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
+dgit push-source "$@"
+git push --follow-tags
+
+# # if origin is not salsa, we might also want to push to salsa
+# # (.mrconfig.in 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