From 59c1222f4df04613fb6e945100151568550e70c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl-Einar=20Bergstr=C3=B8m?= Date: Thu, 15 Oct 2026 16:15:25 +0200 Subject: [PATCH] fix: --dry-run in release script --- scripts/release.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 879a0b4..4509f93 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -11,12 +11,20 @@ # listed under the release that follows. set -euo pipefail -dry=false -if [ "${1:-}" = "--dry-run" ]; then - dry=true - shift -fi -tag="${1:?usage: $0 [--dry-run] }" +usage="usage: $0 [--dry-run] " +# Options anywhere: minor --dry-run must not release. +dry=false tag="" +for arg in "$@"; do + case "$arg" in + --dry-run | -n) dry=true ;; + -*) echo "$arg: unknown option. $usage" >&2; exit 1 ;; + *) + [ -z "$tag" ] || { echo "$arg: one version only. $usage" >&2; exit 1; } + tag=$arg + ;; + esac +done +[ -n "$tag" ] || { echo "$usage" >&2; exit 1; } command -v git-cliff >/dev/null || { echo "git-cliff is needed: brew install git-cliff" >&2; exit 1; } cd "$(dirname "$0")/.."