-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrelease.sh
More file actions
26 lines (21 loc) · 730 Bytes
/
Copy pathrelease.sh
File metadata and controls
26 lines (21 loc) · 730 Bytes
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
#!/bin/bash
set -ex
# builds the site and release to an s3 bucket, invalidate cloudfront distribution
# build site
gem install bundler
bundle install
bundle exec middleman build --clean
# sync site to s3 bucket
cd build
aws s3 sync . s3://${BUCKET}
# invalidate site and wait until complete
aws cloudfront wait distribution-deployed --id "$DISTID"
INVALIDATION=$(aws cloudfront create-invalidation --distribution-id "$DISTID" --paths "/*")
INVALIDATIONID=$(echo $INVALIDATION | jq .Invalidation.Id | tr -d '"')
if [ "${INVALIDATIONID}" = "" ]
then
echo "Error: unable to find Invalidation Id"
echo $INVALIDATION
exit 1
fi
aws cloudfront wait invalidation-completed --distribution-id "$DISTID" --id "$INVALIDATIONID"