-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·53 lines (44 loc) · 1.21 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
if [ -z "$AWSENV_CF_DISTRIBUTION" ]; then
echo "AWSENV_CF_DISTRIBUTION is not set, cannot continue." >&2
exit 1
fi
for STATE in `cat states.json | jq -r '.[].short'`
do
LOCATIONS="$STATE/locations.json"
if [[ -f $LOCATIONS ]];then
COUNT=`cat $LOCATIONS | jq '. | length'`
else
COUNT=0
fi
OUTPUT=`cat states.json | jq '(.[]|select(.short == $state)?) += {count: $newCount}' --argjson newCount "$COUNT" --arg state "$STATE"`
echo $OUTPUT > states.json
done
aws s3 sync ./ s3://findvax-data\
--profile findvax\
--delete\
--exclude "*"\
--include "states.json"\
--include "*/locations.json"\
--cache-control "public; max-age=120; must-revalidate"\
--output json
aws s3 sync ./ s3://findvax-data\
--profile findvax\
--delete\
--exclude "*"\
--include "*/zipcodes.json"\
--cache-control "public; max-age=31536000; must-revalidate"\
--output json
aws s3 sync ./ s3://findvax-data\
--profile findvax\
--delete\
--exclude "*"\
--include "index.html"\
--cache-control "public; max-age=31536000; immutable"\
--output json
aws cloudfront create-invalidation\
--profile findvax\
--distribution-id=$AWSENV_CF_DISTRIBUTION\
--paths /\*\
--output json\
| jq -r '.Invalidation'