From 852f336a341baa54d10aa562f3a78f2087584936 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 13 Apr 2019 16:13:50 -0700
Subject: [PATCH] Allow build testing by failing only the commit step when the
 branch is wrong.

---
 bin/deploy.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bin/deploy.sh b/bin/deploy.sh
index 2a5e91c..a2a9403 100755
--- a/bin/deploy.sh
+++ b/bin/deploy.sh
@@ -58,11 +58,6 @@ if [[ -z "$PLUGIN_VERSION" ]]; then
 	exit 1
 fi
 
-if [[ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" || "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "master" ]]; then
-	echo "Build branch is required and must be 'master'" 1>&2
-	exit 0
-fi
-
 echo "ℹ︎ PLUGIN_SLUG is $PLUGIN_SLUG"
 echo "ℹ︎ PLUGIN_VERSION is $PLUGIN_VERSION"
 
@@ -122,6 +117,12 @@ svn cp "trunk" "tags/$PLUGIN_VERSION"
 
 svn status
 
+# Stop here unless this is a merge into master.
+if [[ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" || "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "master" ]]; then
+	echo "ℹ︎ EXITING before commit step as this is the '${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}' branch, not the 'master' branch." 1>&2
+	exit 0
+fi
+
 echo "➤ Committing files..."
 svn commit -m "Update to version $PLUGIN_VERSION from GitLab ($CI_PROJECT_URL)" --no-auth-cache --non-interactive  --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
 
-- 
GitLab