summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-06-27 11:22:19 +0200
committerRobin Jarry <robin@jarry.cc>2022-06-27 12:37:08 +0200
commit26531fa932607fc4bde7429ae8b4ce864ff5f810 (patch)
tree99746a3c3be2d0071225b0f7576f521b916d75dd
parent964b362ceb1bd4949403a14afe8a953f17d5e9fc (diff)
downloadaerc-26531fa932607fc4bde7429ae8b4ce864ff5f810.zip
contrib: update script to release new version
Signed-off-by: Robin Jarry <robin@jarry.cc>
-rwxr-xr-xcontrib/_incr_version4
-rwxr-xr-xcontrib/release.sh54
2 files changed, 54 insertions, 4 deletions
diff --git a/contrib/_incr_version b/contrib/_incr_version
deleted file mode 100755
index dfd22db..0000000
--- a/contrib/_incr_version
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh -eu
-sed -i Makefile -e "s/^VERSION=${1}/VERSION=${2}/"
-git add Makefile
-git commit -m "Update version to ${2}"
diff --git a/contrib/release.sh b/contrib/release.sh
new file mode 100755
index 0000000..fa70d86
--- /dev/null
+++ b/contrib/release.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+set -e
+
+echo "======= Determining next version..."
+prev_tag=$(git describe --tags --abbrev=0)
+next_tag=$(echo $prev_tag | awk -F. -v OFS=. '{$(NF-1) += 1; print}')
+read -rp "next tag ($next_tag)? " n
+if [ -n "$n" ]; then
+ next_tag="$n"
+fi
+
+echo "======= Updating version in Makefile..."
+sed -i Makefile -e "s/$prev_tag/$next_tag/g"
+git add Makefile
+git commit -sm "Release version $next_tag"
+
+echo "======= Creating tag..."
+git tag --edit --sign \
+ -m "Release $next_tag highlights:" \
+ -m "$(git log --format='- %s' $prev_tag..)" \
+ -m "Thanks to all contributors!" \
+ -m "~\$ git shortlog -sn $prev_tag..$next_tag
+$(git shortlog -sn $prev_tag..)" \
+ "$next_tag"
+
+echo "======= Pushing to remote..."
+git push origin master "$next_tag"
+
+echo "======= Sending release email..."
+
+email=$(mktemp aerc-release-XXXXXXXX.eml)
+trap "rm -f -- $email" EXIT
+
+cat >"$email" <<EOF
+To: aerc-annouce <~rjarry/aerc-announce@lists.sr.ht>
+Cc: aerc <~sircmpwn/aerc@lists.sr.ht>
+Reply-To: aerc-devel <~rjarry/aerc-devel@lists.sr.ht>
+Subject: aerc $next_tag
+User-Agent: aerc/$next_tag
+Message-ID: <$(date +%Y%m%d%H%M%S).$(base64 -w20 < /dev/urandom | head -n1)@$(hostname)>
+
+Hi all,
+
+I am glad to announce the release of aerc $next_tag.
+
+https://git.sr.ht/~rjarry/aerc/refs/$next_tag
+
+$(git tag -l --format='%(contents)' "$next_tag" | sed -n '/BEGIN PGP SIGNATURE/q;p')
+EOF
+
+$EDITOR "$email"
+
+/usr/sbin/sendmail -t < "$email"