21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-14 14:38:39 +02:00

improve deployment scripts

This commit is contained in:
Jérémy Lecour 2022-02-13 19:40:00 +01:00 committed by Jérémy Lecour
parent fe773f3941
commit 100478a90e
2 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr> # Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file) # License: GNU AGPL-3+ (see full text in LICENSE file)
@ -7,22 +7,22 @@ set -e
[ -n "$DEBUG" ] && set -x [ -n "$DEBUG" ] && set -x
# git name-rev is fail # git name-rev is fail
CURRENT=`git rev-parse --abbrev-ref HEAD` CURRENT=$(git rev-parse --abbrev-ref HEAD)
TIMESTAMP=`date +"%s"` TIMESTAMP=$(date +"%s")
echo "👀 Fetching git repository information…" echo "👀 Fetching git repository information…"
git fetch origin --quiet git fetch origin --quiet
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
CURRENT_HEAD=`git rev-parse HEAD` CURRENT_HEAD=$(git rev-parse HEAD)
ORIGIN_HEAD=`git rev-parse origin/master` ORIGIN_HEAD=$(git rev-parse origin/master)
if [ "master" != "${CURRENT_BRANCH}" ]; then if [ "master" != "${CURRENT_BRANCH}" ]; then
echo "😕 Only master can be deployed to production" echo "😕 Only master can be deployed to production"
exit 1 exit 1
fi fi
if [ ${CURRENT_HEAD} != ${ORIGIN_HEAD} ]; then if [ "${CURRENT_HEAD}" != "${ORIGIN_HEAD}" ]; then
echo "😕 Local master is not up to date with origin" echo "😕 Local master is not up to date with origin"
exit 1 exit 1
fi fi

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr> # Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file) # License: GNU AGPL-3+ (see full text in LICENSE file)
@ -9,7 +9,7 @@ set -e
echo "👀 Fetching git repository information…" echo "👀 Fetching git repository information…"
git fetch origin --quiet 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 !" echo "🚀 Deploying ${CURRENT_BRANCH} to staging !"
git branch -f staging git branch -f staging