Skip to content

Commit

Permalink
Only deploy master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonsim committed Jan 15, 2018
1 parent 3cb2dbc commit cbc3a3d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions buildspec-4-sftpdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,26 @@ phases:

# Deployment to the SFTP server
- |
# Determine what git branch we're on, we only want to deploy master
export CODEBUILD_GIT_BRANCH=`git symbolic-ref HEAD --short 2>/dev/null`
if [[ "$CODEBUILD_GIT_BRANCH" == 'master' ]]; then
exit 0
# Determine what git branch we're on, we only want to deploy master
export CODEBUILD_GIT_BRANCH=`git symbolic-ref HEAD --short 2>/dev/null`
if [[ "$CODEBUILD_GIT_BRANCH" == 'master' ]]; then
exit 0
fi
# Install SSH client so we can deploy
apt-get install -y openssh-client
# Install SSH client so we can deploy
apt-get install -y openssh-client
# Setup the SSH key
mkdir ~/.ssh
chmod 700 ~/.ssh
echo $SSH_KEY | base64 -d > ~/.ssh/id_rsa
chmod 600 ~/.ssh/*
# Setup the SSH key
mkdir ~/.ssh
chmod 700 ~/.ssh
echo $SSH_KEY | base64 -d > ~/.ssh/id_rsa
chmod 600 ~/.ssh/*
# Upload Files
scp -o "StrictHostKeyChecking=no" -v -P ${SFTP_PORT} -r . ${SSH_USERNAME}@${SSH_SERVER}:/public_html
# Upload Files
scp -o "StrictHostKeyChecking=no" -v -P ${SFTP_PORT} -r . ${SSH_USERNAME}@${SSH_SERVER}:~/public_html/
# Run any necessary remote commands
ssh -o "StrictHostKeyChecking=no" -v ${SSH_USERNAME}@${SSH_SERVER} -p ${SSH_PORT} 'cd public_html ; composer install --optimize-autoloader; php artisan migrate'
# Run any necessary remote commands
ssh -o "StrictHostKeyChecking=no" -v ${SSH_USERNAME}@${SSH_SERVER} -p ${SSH_PORT} 'cd public_html ; composer install --optimize-autoloader; php artisan migrate'
cache:
paths:
Expand Down

0 comments on commit cbc3a3d

Please sign in to comment.