aerc/contrib/release.sh
Robin Jarry 6504faa88c release.sh: fine tuning
Shuffle the To/Cc/Bcc headers to avoid people from doing reply all to
~sircmpwn/aerc@lists.sr.ht. Also add Cc: aerc-devel so that the lists
archives all have the base message. Unfortunately, there is no way to
prevent people from doing reply all and trying to send emails to
aerc-announce. Putting aerc-announce in Bcc sounds very ugly.

Include the person doing the release as Bcc. sendmail -t does not have
a copy-to=Sent option.

Use base32 and a shorter suffix for Message-ID. base64 is ugly.

Use 'vi' if $EDITOR is unset.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-07-23 22:06:44 +02:00

57 lines
1.5 KiB
Bash
Executable file

#!/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-devel <~rjarry/aerc-devel@lists.sr.ht>
Bcc: aerc <~sircmpwn/aerc@lists.sr.ht>,
$(git config user.name) <$(git config user.email)>
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).$(base32 -w12 < /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:-vi} "$email"
/usr/sbin/sendmail -t < "$email"