forked from crossbario/autobahn-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·70 lines (55 loc) · 2.9 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
#!/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
# ABI JSON files are extracted directly into the package source directory, so they are bundled in the package
echo 'downloading and extracting XBR ABI files ..'
curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip
unzip -t /tmp/xbr-protocol-latest.zip
rm -rf ./autobahn/xbr/contracts
unzip /tmp/xbr-protocol-latest.zip -d ./autobahn/xbr/contracts
# 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/autobahn- || true
# aws s3 cp --recursive ./dist s3://${AWS_S3_BUCKET_NAME}/wheels
aws s3 rm s3://${AWS_S3_BUCKET_NAME}/wheels/autobahn-${AUTOBAHN_VERSION}-py2.py3-none-any.whl
aws s3 rm s3://${AWS_S3_BUCKET_NAME}/wheels/autobahn-latest-py2.py3-none-any.whl
aws s3 cp --acl public-read ./dist/autobahn-${AUTOBAHN_VERSION}-py2.py3-none-any.whl s3://${AWS_S3_BUCKET_NAME}/wheels/autobahn-${AUTOBAHN_VERSION}-py2.py3-none-any.whl
aws s3 cp --acl public-read ./dist/autobahn-${AUTOBAHN_VERSION}-py2.py3-none-any.whl s3://${AWS_S3_BUCKET_NAME}/wheels/autobahn-latest-py2.py3-none-any.whl
#aws s3api copy-object --acl public-read \
# --copy-source wheels/autobahn-${AUTOBAHN_VERSION}-py2.py3-none-any.whl --bucket ${AWS_S3_BUCKET_NAME} \
# --key wheels/autobahn-latest-py2.py3-none-any.whl
aws s3 ls ${AWS_S3_BUCKET_NAME}/wheels/autobahn-
# 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 autobahn \
--keyword publish true
echo ''
echo 'package uploaded to:'
echo ''
echo ' https://crossbarbuilder.s3.eu-central-1.amazonaws.com/wheels/autobahn-'${AUTOBAHN_VERSION}'-py2.py3-none-any.whl'
echo ' https://crossbarbuilder.s3.eu-central-1.amazonaws.com/wheels/autobahn-latest-py2.py3-none-any.whl'
echo ''