-
Notifications
You must be signed in to change notification settings - Fork 22
/
travis-main.sh
59 lines (45 loc) · 1.47 KB
/
travis-main.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -e
if [[ "$TRAVIS_COMMIT_MESSAGE" == "[TRAVIS] Autogenerated files from travis" ]]; then
echo "This is an auto commit from travis. Not doing anything."
exit 0
fi
make init
echo "> Running tests"
make test
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "Not on master. Not doing anything else."
exit 0
fi
if [[ "$TRAVIS_COMMIT_MESSAGE" != *"trigger build"* ]]; then
echo "Do not trigger build. Exiting..."
exit 0
fi
# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//[email protected]:}
SHA=`git rev-parse --verify HEAD`
# Setup credentials
git config user.name "CI auto deploy"
git config user.email "[email protected]"
# Setup deploy keys
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
# Deleting the private key so that we don't accidentally push it back
rm deploy_key
if [[ "$TRAVIS_COMMIT_MESSAGE" == "[TRAVIS] Generate scores" ]]; then
source ./travis/score.sh
fi
if [[ "$TRAVIS_COMMIT_MESSAGE" == "[TRAVIS] Generate ensemble week "* ]]; then
source ./travis/ensemble.sh
elif [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
source ./travis/ensemble.sh
fi
source ./travis/viz.sh
ssh-agent -k