-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·44 lines (40 loc) · 921 Bytes
/
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
#!/bin/bash
# Check if the AWS CLI is in the PATH
found=$(which aws)
if [ -z "$found" ]; then
echo "Please install the AWS CLI under your PATH: http://aws.amazon.com/cli/"
exit 1
fi
export AWS_DEFAULT_PROFILE=personal
export BUCKET=snerted.com
export MAX_AGE=10
# Updating Lambda functions
echo "Sync lambda content"
cd lambda
for f in $(ls -1); do
echo "Updating function $f begin..."
cd $f
bin=""
if [ -d "bin" ]; then
cd bin
for bf in $(ls -1); do
bin+="--extra-file bin/$bf"
done
cd ..
fi
lambda-uploader $bin
cd ..
done
echo "Sync html content..."
cd ../www
for f in $(ls -1 *.html); do
aws s3 cp ./$f s3://$BUCKET --cache-control max-age="$MAX_AGE" --acl public-read
done
cd ..
# Updating www app.js
echo "Sync assets..."
cd www/assets
for f in $(ls -1 *.*); do
aws s3 cp ./$f s3://$BUCKET/assets/ --cache-control max-age="$MAX_AGE" --acl public-read
done
cd ../..