aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-01-26 22:14:02 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-26 22:14:39 +0100
commit161768eb7371b4844dfdfac56ce090a0f0091ff1 (patch)
treea224381b94fdaf2548d01ee5769c784dcd399269 /contrib
parent11b035f120969758d1b08dddd761f9375504de55 (diff)
downloadaerc-161768eb7371b4844dfdfac56ce090a0f0091ff1.tar.gz
release.sh: add --dry-run flag
This allows checking what the changelog will look like when actually releasing. Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/release.sh38
1 files changed, 23 insertions, 15 deletions
diff --git a/contrib/release.sh b/contrib/release.sh
index 001c68d2..c5a83d3b 100755
--- a/contrib/release.sh
+++ b/contrib/release.sh
@@ -2,19 +2,7 @@
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
-tag_url="https://git.sr.ht/~rjarry/aerc/refs/$next_tag"
-
-echo "======= Creating release commit..."
-sed -i GNUmakefile -e "s/$prev_tag/$next_tag/g"
-make wrap
-{
+changelog() {
echo
echo "## [$next_tag]($tag_url) - $(date +%Y-%m-%d)"
for kind in Added Fixed Changed Deprecated; do
@@ -23,12 +11,32 @@ make wrap
echo
echo "### $kind"
echo
- git log --format="$format" $prev_tag.. | \
+ git log --reverse --format="$format" $prev_tag.. | \
sed '/^$/d; s/[[:space:]]\+/ /; s/^/- /' | \
./wrap -r
fi
done
-} > .changelog.md
+}
+
+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
+tag_url="https://git.sr.ht/~rjarry/aerc/refs/$next_tag"
+case "$1" in
+-n|--dry-run)
+ changelog
+ exit
+ ;;
+esac
+
+echo "======= Creating release commit..."
+sed -i GNUmakefile -e "s/$prev_tag/$next_tag/g"
+make wrap
+changelog > .changelog.md
sed -i CHANGELOG.md -e '/^The format is based on/ r .changelog.md'
${EDITOR:-vi} CHANGELOG.md
rm -f .changelog.md