mirror of
https://github.com/Evolix/chexpire.git
synced 2024-06-26 19:12:53 +02:00
37 lines
759 B
Plaintext
37 lines
759 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
[ -n "$DEBUG" ] && set -x
|
||
|
|
||
|
# git name-rev is fail
|
||
|
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`
|
||
|
|
||
|
if [ "master" != "${CURRENT_BRANCH}" ]; then
|
||
|
echo "😕 Only master can be deployed to production"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ${CURRENT_HEAD} != ${ORIGIN_HEAD} ]; then
|
||
|
echo "😕 Local master is not up to date with origin"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
read -p "👉 Deploy master to production ? (y/N) " confirmed
|
||
|
|
||
|
if [ "${confirmed}" != "y" ]; then
|
||
|
echo "😞 Abort, bye."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
bundle exec cap production deploy
|
||
|
|
||
|
echo "😎 Done !"
|