This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3866
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit db9e5d2692ec1bfee8a3ba9049b3cb6997a53c89
Author: Dan Haywood <[email protected]>
AuthorDate: Mon Oct 13 06:41:07 2025 +0100

    improves release procedure a little
---
 scripts/promoterctag.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 88 insertions(+), 9 deletions(-)

diff --git a/scripts/promoterctag.sh b/scripts/promoterctag.sh
index 463eeef2eef..6ee562ba201 100755
--- a/scripts/promoterctag.sh
+++ b/scripts/promoterctag.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #  Licensed to the Apache Software Foundation (ASF) under one
 #  or more contributor license agreements.  See the NOTICE file
 #  distributed with this work for additional information
@@ -17,14 +17,93 @@
 #  under the License.
 
 
-
 #
-# Removes an RC tag and replaces with final one
+# promoterctag — promote an RC tag to final release
+#
+# Removes an RC tag (e.g., causeway-1.2.0-RC1) and replaces it with the final 
tag (e.g., causeway-1.2.0).
+#
+# Usage:
+#   promoterctag <baseTag> <rcSuffix> [--dry-run|--whatif]
+#
+# Example:
+#   promoterctag causeway-1.2.0 RC1
 #
-# usage: 
-# promoterctag causeway-1.2.0 RC1
+#   promoterctag causeway-1.2.0 RC1 --dry-run
+#
+
+set -euo pipefail
+
+usage() {
+  echo "Usage: $0 <baseTag> <rcSuffix> [--dry-run|--whatif]"
+  echo
+  echo "Promotes a release candidate (RC) tag to its final release."
+  echo
+  echo "Example:"
+  echo "  $0 causeway-1.2.0 RC1"
+  echo "  $0 causeway-1.2.0 RC1 --dry-run"
+  exit 1
+}
+
+# --- parse args ---
+if [[ $# -lt 2 ]]; then
+  usage
+fi
+
+BASE_TAG="$1"
+RC_SUFFIX="$2"
+RC_TAG="${BASE_TAG}-${RC_SUFFIX}"
+DRY_RUN=false
+
+if [[ $# -eq 3 ]]; then
+  case "$3" in
+    --dry-run|--whatif)
+      DRY_RUN=true
+      ;;
+    *)
+      echo "Unknown option: $3"
+      usage
+      ;;
+  esac
+fi
+
+# --- sanity checks ---
+if ! git rev-parse "$RC_TAG" >/dev/null 2>&1; then
+  echo "❌ RC tag '$RC_TAG' does not exist."
+  exit 1
+fi
+
+if git rev-parse "$BASE_TAG" >/dev/null 2>&1; then
+  echo "⚠️  Final tag '$BASE_TAG' already exists and will be overwritten."
+fi
+
+echo "=========================================="
+echo " Promoting RC tag to final release"
+echo "------------------------------------------"
+echo " Base tag:   $BASE_TAG"
+echo " RC tag:     $RC_TAG"
+echo " Remote:     origin"
+echo " Dry-run:    $DRY_RUN"
+echo "=========================================="
+echo
+
+# --- perform operations ---
+run() {
+  if $DRY_RUN; then
+    echo "[dry-run] $*"
+  else
+    echo "▶ $*"
+    eval "$@"
+  fi
+}
+
+run "git tag -f \"$BASE_TAG\" \"$RC_TAG\""
+run "git tag -d \"$RC_TAG\""
+run "git push origin :refs/tags/$RC_TAG"
+run "git push origin refs/tags/$BASE_TAG:refs/tags/rel/$BASE_TAG"
 
-git tag -f $1 $1-$2
-git tag -d $1-$2
-git push origin :refs/tags/$1-$2
-git push origin refs/tags/$1:refs/tags/rel/$1
+echo
+if $DRY_RUN; then
+  echo "✅ Dry run complete. No changes made."
+else
+  echo "✅ RC tag '$RC_TAG' promoted to '$BASE_TAG' and pushed."
+fi

Reply via email to