From f01418b74ab101316e8a61a4b0d96fcc11552aec Mon Sep 17 00:00:00 2001
From: Antoine Regimbeau <antoine.regimbeau@c-s.fr>
Date: Fri, 21 Jun 2019 08:22:26 +0200
Subject: [PATCH] Fix mistake in script and add rc variable

---
 .gitlab-ci.yml | 2 +-
 CI/deploy.sh   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 509dbd01e3..742ad7519c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -175,7 +175,7 @@ deploy:
     # Checkout the expected branch
     - git checkout -f -q $CI_COMMIT_SHA
   script:
-    - ./CI/deploy.sh $CI_COMMIT_REF_NAME
+    - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
   dependencies:
     - ubuntu-superbuild-build 
     - centos-superbuild-build
diff --git a/CI/deploy.sh b/CI/deploy.sh
index 2fff5ec081..051bc2ee08 100755
--- a/CI/deploy.sh
+++ b/CI/deploy.sh
@@ -2,13 +2,13 @@
 # Configure git for tar.xz
 git config tar.tar.xz.command "xz -c"
 
-if [ $1 = "develop" ] # check if the branch name is develop or not
 pack_suffix=""
+if [ $1 = "develop" ] # check if the branch name is develop or not
 then # we are on develop
   jobs_directory=/home/otbpush/test/$(date +%F)
 else # we are on a release branch
   jobs_directory=/home/otbpush/test/staging
-  if [ \( "$#" -eq 2 \) && \( echo "$2" | grep "rc[0-9]*" \) ]
+  if [ "$#" -eq 2 ]
     then # there is a rc tag, we need a suffix for packages
     pack_suffix=$(echo "$2" | grep -o "rc[0-9]*") # this retrieve the rc number
   fi
@@ -43,7 +43,7 @@ find build_packages/. -name "*.run" \
 
 # TO REMOVE
 ###########
-ls -all
+ls -all build_packages/
 ###########
 
 echo "Pushing binary packages"
-- 
GitLab