From 100478a90e8298c8f22914d2e2a9c232e9957fcb Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Sun, 13 Feb 2022 19:40:00 +0100 Subject: [PATCH] improve deployment scripts --- script/to_production | 14 +++++++------- script/to_staging | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/script/to_production b/script/to_production index 3352a7b..4ed4245 100755 --- a/script/to_production +++ b/script/to_production @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) @@ -7,22 +7,22 @@ set -e [ -n "$DEBUG" ] && set -x # git name-rev is fail -CURRENT=`git rev-parse --abbrev-ref HEAD` -TIMESTAMP=`date +"%s"` +CURRENT=$(git rev-parse --abbrev-ref HEAD) +TIMESTAMP=$(date +"%s") echo "👀 Fetching git repository information…" git fetch origin --quiet -CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` -CURRENT_HEAD=`git rev-parse HEAD` -ORIGIN_HEAD=`git rev-parse origin/master` +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +CURRENT_HEAD=$(git rev-parse HEAD) +ORIGIN_HEAD=$(git rev-parse origin/master) if [ "master" != "${CURRENT_BRANCH}" ]; then echo "😕 Only master can be deployed to production" exit 1 fi -if [ ${CURRENT_HEAD} != ${ORIGIN_HEAD} ]; then +if [ "${CURRENT_HEAD}" != "${ORIGIN_HEAD}" ]; then echo "😕 Local master is not up to date with origin" exit 1 fi diff --git a/script/to_staging b/script/to_staging index d76bd39..1593a09 100755 --- a/script/to_staging +++ b/script/to_staging @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) @@ -9,7 +9,7 @@ set -e echo "👀 Fetching git repository information…" git fetch origin --quiet -CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo "🚀 Deploying ${CURRENT_BRANCH} to staging !" git branch -f staging