File tree Expand file tree Collapse file tree 2 files changed +31
-31
lines changed
Expand file tree Collapse file tree 2 files changed +31
-31
lines changed Original file line number Diff line number Diff line change @@ -77,37 +77,7 @@ phases:
7777 - aws s3 sync --delete coverage/ "s3://${COVERAGE_S3_BUCKET}/coverage"
7878
7979 # Deployment to the SFTP server
80- - |
81- set -e
82- cat /codebuild/output/tmp/script.sh
83-
84- # Determine what git branch we're on, we only want to deploy master
85- export CODEBUILD_GIT_BRANCH=`git symbolic-ref HEAD --short 2>/dev/null`
86- if [ "$CODEBUILD_GIT_BRANCH" == "" ] ; then
87- CODEBUILD_GIT_BRANCH=`git branch -a --contains HEAD | sed -n 2p | awk '{ printf $1 }'`
88- export CODEBUILD_GIT_BRANCH=${CODEBUILD_GIT_BRANCH#remotes/origin/}
89- fi
90-
91- echo "On branch $CODEBUILD_GIT_BRANCH"
92- if [ "$CODEBUILD_GIT_BRANCH" != 'master' ]; then
93- echo "On branch $CODEBUILD_GIT_BRANCH ; not deploying as not master"
94- exit 0
95- fi
96-
97- # Install SSH client so we can deploy
98- apt-get install -y openssh-client rsync
99-
100- # Setup the SSH key
101- mkdir ~/.ssh
102- chmod 700 ~/.ssh
103- echo $SSH_KEY | base64 -d > ~/.ssh/id_rsa
104- chmod 600 ~/.ssh/*
105-
106- # Upload Files
107- rsync -arvce --delete-after "ssh -o StrictHostKeyChecking=no -p ${SFTP_PORT}" . ${SSH_USERNAME}@${SSH_SERVER}:~/public_html/
108-
109- # Run any necessary remote commands
110- ssh -o "StrictHostKeyChecking=no" ${SSH_USERNAME}@${SSH_SERVER} -p ${SSH_PORT} 'cd public_html ; composer install --optimize-autoloader; php artisan migrate'
80+ - ./codebuild-deploy.sh
11181
11282cache :
11383 paths :
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+
4+ # Determine what git branch we're on, we only want to deploy master
5+ export CODEBUILD_GIT_BRANCH=` git symbolic-ref HEAD --short 2> /dev/null`
6+ if [ " $CODEBUILD_GIT_BRANCH " == " " ] ; then
7+ CODEBUILD_GIT_BRANCH=` git branch -a --contains HEAD | sed -n 2p | awk ' { printf $1 }' `
8+ export CODEBUILD_GIT_BRANCH=${CODEBUILD_GIT_BRANCH# remotes/ origin/ }
9+ fi
10+
11+ echo " On branch $CODEBUILD_GIT_BRANCH "
12+ if [ " $CODEBUILD_GIT_BRANCH " != ' master' ]; then
13+ echo " On branch $CODEBUILD_GIT_BRANCH ; not deploying as not master"
14+ exit 0
15+ fi
16+
17+ # Install SSH client so we can deploy
18+ apt-get install -y openssh-client rsync
19+
20+ # Setup the SSH key
21+ mkdir ~ /.ssh
22+ chmod 700 ~ /.ssh
23+ echo $SSH_KEY | base64 -d > ~ /.ssh/id_rsa
24+ chmod 600 ~ /.ssh/*
25+
26+ # Upload Files
27+ rsync -arvce --delete-after " ssh -o StrictHostKeyChecking=no -p ${SFTP_PORT} " . ${SSH_USERNAME} @${SSH_SERVER} :~ /public_html/
28+
29+ # Run any necessary remote commands
30+ ssh -o " StrictHostKeyChecking=no" ${SSH_USERNAME} @${SSH_SERVER} -p ${SSH_PORT} ' cd public_html ; composer install --optimize-autoloader; php artisan migrate'
You can’t perform that action at this time.
0 commit comments