Skip to content

Commit 0b1fc13

Browse files
authored
Merge pull request #7 from commitdev/add-cloudfront-invalidation
Add a cloudfront invalidation step to deploy
2 parents bd60d8b + eeb69e4 commit 0b1fc13

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.circleci/config.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
parameters:
123123
config:
124124
description: |
125-
The config file you want to build the app using.
125+
The config file you want to build the app using.
126126
E.g. 'development' would load configurations from 'config/development.json'
127127
type: enum
128128
enum: ["development", "staging", "production"]
@@ -161,7 +161,7 @@ jobs:
161161
parameters:
162162
config:
163163
description: |
164-
The config file you want to build the app using.
164+
The config file you want to build the app using.
165165
E.g. 'development' would load configurations from 'config/development.json'
166166
type: enum
167167
enum: ["development", "staging", "production"]
@@ -178,11 +178,17 @@ jobs:
178178
- attach_workspace:
179179
at: *workspace
180180
- run: # Required by aws-cli
181+
name: Set AWS region var
181182
command: echo 'export AWS_REGION=<< parameters.region >>' >> $BASH_ENV
182183
- aws-s3/sync:
183184
from: build_<< parameters.config >>
184185
overwrite: true
185186
to: 's3://<< parameters.bucket >>'
187+
- run:
188+
name: Invalidate Cloudfront
189+
command: |
190+
export DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[?contains(@, '<< parameters.bucket >>')]].Id | [0]" | tr -d '"')
191+
aws cloudfront create-invalidation --distribution-id ${DIST_ID} --paths "/*"
186192
187193
workflows:
188194
version: 2

0 commit comments

Comments
 (0)