-
Notifications
You must be signed in to change notification settings - Fork 6
/
deploy.sh
executable file
·78 lines (60 loc) · 2.89 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
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set +o verbose -o errexit
# AWS_DEFAULT_REGION : must be set in CI build context!
# AWS_S3_BUCKET_NAME : must be set in CI build context!
# AWS_ACCESS_KEY_ID : must be set in CI build context!
# AWS_SECRET_ACCESS_KEY : must be set in CI build context!
# WAMP_PRIVATE_KEY : must be set in CI build context!
echo 'AWS env vars (should be 4):'
env | grep AWS_ | wc -l
echo 'WAMP_PRIVATE_KEY env var (should be 1):'
env | grep WAMP_PRIVATE_KEY | wc -l
# set up awscli package
echo 'installing aws tools ..'
pip install awscli
which aws
aws --version
# 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 ls" will return -1 when no files are found! but we don't want our script to exit
aws s3 ls ${AWS_S3_BUCKET_NAME}/wheels/cfxdb- || true
# aws s3 cp --recursive ./dist s3://${AWS_S3_BUCKET_NAME}/wheels
aws s3 rm s3://${AWS_S3_BUCKET_NAME}/wheels/cfxdb-${CFXDB_VERSION}-py2.py3-none-any.whl
aws s3 rm s3://${AWS_S3_BUCKET_NAME}/wheels/cfxdb-latest-py2.py3-none-any.whl
aws s3 cp --acl public-read ./dist/cfxdb-${CFXDB_VERSION}-py2.py3-none-any.whl s3://${AWS_S3_BUCKET_NAME}/wheels/cfxdb-${CFXDB_VERSION}-py2.py3-none-any.whl
aws s3 cp --acl public-read ./dist/cfxdb-${CFXDB_VERSION}-py2.py3-none-any.whl s3://${AWS_S3_BUCKET_NAME}/wheels/cfxdb-latest-py2.py3-none-any.whl
#aws s3api copy-object --acl public-read \
# --copy-source wheels/cfxdb-${CFXDB_VERSION}-py2.py3-none-any.whl --bucket ${AWS_S3_BUCKET_NAME} \
# --key wheels/cfxdb-latest-py2.py3-none-any.whl
aws s3 ls ${AWS_S3_BUCKET_NAME}/wheels/cfxdb-
# tell crossbar-builder about this new wheel push
# get 'wamp' command, always with latest autobahn master
pip install -q -I https://github.com/crossbario/autobahn-python/archive/master.zip#egg=autobahn[twisted,serialization,encryption]
# use 'wamp' to notify crossbar-builder
wamp --max-failures 3 \
--authid wheel_pusher \
--url ws://office2dmz.crossbario.com:8008/ \
--realm webhook call builder.wheel_pushed \
--keyword name cfxdb \
--keyword publish true
echo ''
echo 'package uploaded to:'
echo ''
echo ' https://crossbarbuilder.s3.eu-central-1.amazonaws.com/wheels/cfxdb-'${CFXDB_VERSION}'-py2.py3-none-any.whl'
echo ' https://crossbarbuilder.s3.eu-central-1.amazonaws.com/wheels/cfxdb-latest-py2.py3-none-any.whl'
echo ''
export AWS_S3_BUCKET_NAME=crossbario.com
export AWS_DEFAULT_REGION=eu-central-1
echo 'building and uploading docs ..'
tox -c tox.ini -e sphinx
aws s3 cp --recursive --acl public-read ./docs/_build s3://${AWS_S3_BUCKET_NAME}/docs/cfxdb
aws cloudfront create-invalidation --distribution-id E1FNQA2EBNGVQC --paths "/docs/cfxdb/*"
echo ''
echo 'docs uploaded to:'
echo ''
echo ' https://crossbario.com/docs/cfxdb/'
echo ''