Skip to content

Commit add4d2e

Browse files
authored
better release script - add publish of cfn and cleanup (#419)
1 parent cdc1251 commit add4d2e

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

assets/publish_lambda_layer.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
#!/bin/bash
2+
# This script can be used for release or testing of lambda layers upload.
13
export CID_VERSION=$(python3 -c "from cid import _version;print(_version.__version__)")
4+
rm -rf build
25

6+
echo 'Building a layer'
37
mkdir -p ./python
48
pip3 install . -t ./python
59
zip -qr cid-$CID_VERSION.zip ./python
6-
ls cid-$CID_VERSION.zip
10+
ls -l cid-$CID_VERSION.zip
711
rm -rf ./python
812

913
export AWS_REGION=us-east-1
@@ -29,5 +33,20 @@ aws cloudformation list-stack-instances \
2933
fi
3034
done
3135

32-
echo 'cleanup'
36+
echo 'Cleanup'
3337
rm -vf ./cid-$CID_VERSION.zip
38+
39+
40+
# Publish cfn (only works for the release)
41+
aws s3 ls aws-managed-cost-intelligence-dashboards
42+
if [ $? -eq 0 ]; then
43+
echo "Updating cid-cfn.yml"
44+
aws s3api put-object \
45+
--bucket "aws-managed-cost-intelligence-dashboards" \
46+
--key cfn/cid-cfn.yml \
47+
--body ./cfn-templates/cid-cfn.yml
48+
else
49+
echo "Not a main account. Skipping update of cid-cfn.yml"
50+
fi
51+
52+
echo 'Done'

0 commit comments

Comments
 (0)