Last active
August 29, 2015 14:07
-
-
Save jlecour/6baaeca6fbd911569f67 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
[ -n "$DEBUG" ] && set -x | |
CAP_BIN="bin/cap" | |
CAP_COMMAND="${CAP_BIN} production" | |
# git name-rev is fail | |
CURRENT=`git branch | grep '\*' | awk '{print $2}'` | |
TIMESTAMP=`date +"%s"` | |
TAG="prod-${TIMESTAMP}-${USER}" | |
if [ "master" = "${CURRENT}" ] | |
then | |
# une branche "production" est (re)initialisée sur le commit courant | |
git branch -f production | |
# … et poussée sur le remote "origin" | |
git push --force origin production | |
# et le déploiement a lieu | |
if [ "${MIGRATE}" == '1' ]; then | |
$CAP_COMMAND deploy:migrations | |
else | |
$CAP_COMMAND deploy | |
fi | |
# création du tag | |
git tag ${TAG} && git push origin tag ${TAG} | |
else | |
echo "Impossible de passer en production sans être sur 'master'" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
[ -n "$DEBUG" ] && set -x | |
CAP_BIN="bin/cap" | |
CAP_COMMAND="${CAP_BIN} staging" | |
git branch -f staging | |
git push --force origin staging | |
if [ "${MIGRATE}" == '1' ]; then | |
$CAP_COMMAND deploy:migrations | |
else | |
$CAP_COMMAND deploy | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment