forked from lambci/lambci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·29 lines (19 loc) · 1.33 KB
/
publish.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
#!/bin/bash -ex
REGIONS="$(aws ssm get-parameters-by-path --path /aws/service/global-infrastructure/services/lambda/regions \
--query 'Parameters[].Value' --output text | tr '[:blank:]' '\n' | grep -v -e ^cn- -e ^us-gov- | sort -r)"
VERSION=$(npm run -s v)
echo $VERSION > /tmp/lambci.txt
aws s3api put-object --bucket lambci --key fn/lambci-build-${VERSION}.zip --body build/lambda.zip --acl public-read
aws s3api copy-object --copy-source lambci/fn/lambci-build-${VERSION}.zip --bucket lambci --key fn/lambci-build-latest.zip --acl public-read &
aws s3api put-object --bucket lambci --key fn/latest.txt --body /tmp/lambci.txt --acl public-read &
npm run template
aws s3api put-object --bucket lambci --key templates/lambci.template --body build/versioned.yaml --acl public-read &
aws s3api put-object --bucket lambci --key templates/template.yaml --body build/versioned.yaml --acl public-read &
for region in $REGIONS; do
aws s3api copy-object --region $region --copy-source lambci/fn/lambci-build-${VERSION}.zip --bucket lambci-${region} --key fn/lambci-build-${VERSION}.zip --acl public-read && \
aws s3api copy-object --region $region --copy-source lambci-${region}/fn/lambci-build-${VERSION}.zip --bucket lambci-${region} --key fn/lambci-build-latest.zip --acl public-read &
done
for job in $(jobs -p); do
wait $job
done
rm /tmp/lambci.txt