Created
February 24, 2017 18:17
-
-
Save arnabdas/5b44aec4e69bc4e171363c0d2d634848 to your computer and use it in GitHub Desktop.
Deploy with rsync
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 | |
# Run with the command: `./deploy.sh live go` | |
$SERVER_IP="xx.xx.xx.xx" | |
$ERRORSTRING="Error. Please make sure you've indicated correct parameters" | |
cd ./public | |
if [ $# -eq 0 ] | |
then | |
echo $ERRORSTRING; | |
elif [ $1 == "live" ] | |
then | |
if [[ -z $2 ]] | |
then | |
echo "Running dry-run" | |
rsync --dry-run -az --force --delete --progress -e "ssh -p22 -i /home/gitlab-runner/.ssh/id_rsa " ./ build@{$SERVER_IP}:/usr/share/nginx/html | |
elif [ $2 == "go" ] | |
then | |
echo "Running actual deploy" | |
rsync -az --force --delete --progress -e "ssh -p22 -i /home/gitlab-runner/.ssh/id_rsa " ./ build@{$SERVER_IP}:/usr/share/nginx/html | |
else | |
echo $ERRORSTRING; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment