-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis-deploy.sh
executable file
·51 lines (39 loc) · 1.64 KB
/
.travis-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
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
#!/bin/bash
export AWS_DEFAULT_REGION=eu-central-1
export AWS_S3_BUCKET_NAME=crossbarbuilder
# AWS_ACCESS_KEY_ID : must be set in Travis CI build context
# AWS_SECRET_ACCESS_KEY : must be set in Travis CI build context
set -ev
# TRAVIS_BRANCH, TRAVIS_PULL_REQUEST, TRAVIS_TAG
# PR => don't deploy and exit
if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then
echo '[1] deploy script called for PR - exiting ..';
exit 0;
# direct push to master => deploy
elif [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
echo '[2] deploy script called for direct push to master: continuing to deploy!';
# tagged release => deploy
elif [ -n "$TRAVIS_TAG" ]; then
echo '[3] deploy script called for tagged release: continuing to deploy!';
# outside travis? => deploy
else
echo '[?] deploy script called outside Travis? continuing to deploy!';
fi
# only show number of env vars .. should be 4 on master branch!
# https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
# Travis CI makes encrypted variables and data available only to pull requests coming from the same repository.
echo 'aws env vars (should be 4 - but only on master branch!):'
env | grep AWS | wc -l
# set up awscli package
echo 'installing aws tools ..'
pip install awscli wheel
which aws
aws --version
aws s3 ls ${AWS_S3_BUCKET_NAME}/wheels/
# build python source dist and wheels
echo 'building package ..'
python setup.py sdist bdist_wheel --universal
ls -la ./dist
# upload to S3: https://s3.eu-central-1.amazonaws.com/crossbarbuilder/wheels/
echo 'uploading package ..'
aws s3 cp --recursive ./dist s3://${AWS_S3_BUCKET_NAME}/wheels