forked from lambci/lambci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·40 lines (31 loc) · 1.21 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
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash -ex
REGIONS="\
ap-northeast-1 \
ap-northeast-2 \
ap-south-1 \
ap-southeast-1 \
ap-southeast-2 \
ca-central-1 \
eu-central-1 \
eu-west-1 \
eu-west-2 \
sa-east-1 \
us-east-1 \
us-east-2 \
us-west-1 \
us-west-2 \
"
VERSION=$(npm run -s v)
echo $VERSION > /tmp/lambci.txt
aws s3api put-object --bucket lambci --key fn/lambci-build-${VERSION}.zip --body 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 &
aws s3api put-object --bucket lambci --key templates/lambci.template --body lambci.template --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