-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·24 lines (23 loc) · 1.15 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
#Please add variables as environmental variables in Travis settings for the project when using this script.
#These lines should also be added in the "script block" of travis.yml.
#- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
#- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH"
#echo $BRANCH
BRANCH=$1
#echo $BRANCH
#echo $TRAVIS_REPO_SLUG
#echo $TRAVIS_PULL_REQUEST
github_message=https://nin.artsdatabanken.no/$BRANCH
echo "Making archive..."
tar --directory=build -zcf $BRANCH.tar.gz .
echo "Deploying..."
if [ "${BRANCH}" == "test" ]
then
sshpass -p $scp_pass scp -o StrictHostKeyChecking=no $BRANCH.tar.gz $scp_user@$scp_dest
#Posting to slack to trigger deployment
curl -X POST --data-urlencode "payload={\"channel\": \"$slack_chan\", \"username\": \"travis not the band\", \"text\": \"$slack_command\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/$SLACK_TOKEN
sshpass -p $scp_pass scp -o StrictHostKeyChecking=no $BRANCH.tar.gz $scp_user@$prod_dest
else
echo "This branch will not be deployed, since it's not the test branch."
fi