generated from arabold/serverless-react-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·32 lines (24 loc) · 1.12 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
# Waveforme deploy.sh
# Copyright (C) 2023 Reese Norris - All Rights Reserved
# Kill dist
rm -r dist
# Build browser dist files
echo "Building browser files"
webpack --config webpack.config.browser.js --env IS_OFFLINE=false
# Deploy lambda functions
echo "Deploying lambda functions"
sls deploy
# Compress files with gzip
echo "Compressing files"
find dist \( -iname '*.html' -o -iname '*.htm' -o -iname '*.css' -o -iname '*.js' -o -iname '*.xml' -o -iname '*.txt' \) -exec gzip -v9 -n {} \; -exec mv {}.gz {} \;
# Upload to waveforme-dist S3
echo "Syncing S3 dist bucket"
# Delete all existing files
echo "Deleting current objects"
aws s3 rm s3://waveforme-dist --recursive
# Upload all gzipped files flagged as gzip
echo "Uploading gzip files"
aws s3 sync dist/ s3://waveforme-dist --exclude '*' --include '*.html' --include '*.htm' --include '*.css' --include '*.js' --include '*.xml' --include '*.txt' --content-encoding 'gzip'
# Upload all other files
echo "Uploading all other files"
aws s3 sync dist/ s3://waveforme-dist --exclude '*.html' --exclude '*.htm' --exclude '*.css' --exclude '*.js' --exclude '*.xml' --exclude '*.txt'