Created
October 5, 2016 15:28
-
-
Save tibotiber/cd933537b990c7a5466c2f1e7a309efb to your computer and use it in GitHub Desktop.
Medium post content (8/8/2016)
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/bash | |
# print outputs and exit on first failure | |
set -xe | |
if [ $TRAVIS_BRANCH == "master" ] ; then | |
# setup ssh agent, git config and remote | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/travis_rsa | |
git remote add deploy "[email protected]:/var/www/planecq.com" | |
git config user.name "Travis CI" | |
git config user.email "[email protected]" | |
# commit compressed files and push it to remote | |
rm -f .gitignore | |
cp .travis/deployignore .gitignore | |
git add . | |
git status # debug | |
git commit -m "Deploy compressed files" | |
git push -f deploy HEAD:master | |
elif [ $TRAVIS_BRANCH == "staging" ] ; then | |
# setup ssh agent, git config and remote | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/travis_rsa | |
git remote add deploy "[email protected]:/var/www/planecq.xyz" | |
git config user.name "Travis CI" | |
git config user.email "[email protected]" | |
# commit compressed files and push it to remote | |
rm -f .gitignore | |
cp .travis/deployignore .gitignore | |
git add . | |
git status # debug | |
git commit -m "Deploy compressed files" | |
git push -f deploy HEAD:master | |
else | |
echo "No deploy script for branch '$TRAVIS_BRANCH'" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment