Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
aws-static-site-deploy: realself/aws-static-site-deploy@1.0.1
Use aws-static-site-deploy
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
copy contents of local dir to S3 bucket then invalidate cloudfront cache
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
access-key | Value of AWS_ACCESS_KEY_ID | Yes | - | string |
secret-key | Value of AWS_SECRET_ACCESS_KEY | Yes | - | string |
to | A URI to an S3 bucket, i.e. 's3://the-name-my-bucket' | Yes | - | string |
from | A local *directory* path to sync with S3 | Yes | - | string |
distribution-id | Cloudfront Distribution Id for cache invalidation. | Yes | - | string |
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
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
copy files to S3 bucket and then create an Cloudfront invalidation
on the distribution.
orbs:
aws-s3: circleci/aws-s3@1.0.11
commands:
copy-site:
description: |
copy contents of local dir to S3 bucket then invalidate cloudfront cache
parameters:
access-key:
description: "Value of AWS_ACCESS_KEY_ID"
type: string
secret-key:
description: "Value of AWS_SECRET_ACCESS_KEY"
type: string
to:
description: "A URI to an S3 bucket, i.e. 's3://the-name-my-bucket'"
type: string
from:
description: "A local *directory* path to sync with S3"
type: string
distribution-id:
description: "Cloudfront Distribution Id for cache invalidation."
type: string
steps:
- aws-s3/sync:
from: << parameters.from >>
to: << parameters.to >>
aws-access-key-id: << parameters.access-key >>
aws-secret-access-key: << parameters.secret-key >>
arguments: |
--delete
- run:
name: "Invalidate CloudFront Cache"
command: |
aws cloudfront create-invalidation --distribution-id << parameters.distribution-id >> --paths "/*"