releaser - Optionally split the "build" and "publish" steps
authorTim Otten <to-git@think.hm>
Fri, 15 Mar 2013 19:38:23 +0000 (15:38 -0400)
committerTim Otten <to-git@think.hm>
Fri, 15 Mar 2013 19:38:23 +0000 (15:38 -0400)
This allows one to test the tarballs produced by distmaker before publishing anything.

tools/scripts/releaser/releaser

index b4406993eca4bbd14fc0b6de8dfef0db506e427f..09eaacd6e653cbbbe4ba98614d01ba38c9c075c0 100755 (executable)
@@ -4,6 +4,7 @@ set -e
 confdir=$(dirname $0)
 start_point="$1"
 version="$2"
+first_act="$3"
 distmaker_tgt=all
 
 if [ ! -f "$confdir/releaser.conf" ]; then
@@ -13,9 +14,14 @@ if [ ! -f "$confdir/releaser.conf" ]; then
 fi
 source "$confdir/releaser.conf"
 
-if [ -z "$version" -o -z "$start_point" ]; then
+if [ -z "$start_point" -o -z "$version" -o -z "$first_act" ]; then
   echo
-  echo "Usage: $0 <start_point> <version>"
+  echo "Usage:"
+  echo "  $0 <start_point> <version> --build"
+  echo "  $0 <start_point> <version> --publish"
+  echo "  $0 <start_point> <version> --clean"
+  echo "  $0 <start_point> <version> --build --publish --clean [[ORDER SIGNIFICANT]]"
+  echo "Arguments:"
   echo "  <start_point> is a branch name (e.g. \"master\")"
   echo "  <version> is Civi release (e.g. \"4.3.beta2\"); it will become a tag name"
   exit 2
@@ -27,8 +33,6 @@ else
   is_stable=
 fi
 
-set -ex
-
 #################################################
 ## Git setup
 function do_git_config() {
@@ -165,10 +169,32 @@ function do_cleanup() {
 
 ## Refactoring note: this used to be one monolithic script
 
-do_git_config
-do_mk_project
-do_git_tag
-do_distmaker
-do_git_tag_push
-do_publish
-do_cleanup
+shift ## start point
+shift ## version
+for ACT in "$@" ; do
+  case "$ACT" in
+    --build)
+      set -ex
+      do_git_config
+      do_mk_project
+      do_git_tag
+      do_distmaker
+      set +x
+      ;;
+    --publish)
+      set -ex
+      do_git_tag_push
+      do_publish
+      set +x
+      ;;
+    --clean)
+      set -ex
+      do_cleanup
+      set +x
+      ;;
+    *)
+      echo "unrecognized: $ACT"
+      ;;
+  esac
+done
+