Skip to content

Commit 6c72d48

Browse files
committed
Merge branch 'develop'
2 parents 2e049c8 + ecd58b1 commit 6c72d48

File tree

2 files changed

+29
-96
lines changed

2 files changed

+29
-96
lines changed

.github/workflows/deploy-dev.js.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ jobs:
8585
# aws-secret-access-key: ${{ secrets.AWS_SECRET }}
8686
# aws-region: us-east-1
8787

88+
- name: Deploy
89+
run: serverless client deploy --no-confirm
90+
8891
- name: Create CloudFront invalidation
8992
uses: josemando/aws-cloudfront-create-invalidation@v1
9093
with:
91-
distribution-id: E2FD1T2JUN28HB
94+
distribution-id: E621UP8SM3SXE
9295
paths: /*
9396

94-
- name: Deploy
95-
run: serverless client deploy --no-confirm
96-
9797
# Optional (to use with serverless-finch serverless plugin)
9898
#- name: Deploy assets to S3
9999
# run: sls client deploy --no-delete-contents --no-confirm -s dev

serverless.yml

Lines changed: 25 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -48,97 +48,30 @@ custom:
4848
client:
4949
bucketName: ${self:custom.rootName}
5050
distributionFolder: build
51-
# s3LocalPath: C:\Projects\AbstractPlay\front\build\
52-
s3LocalPath: ./build/
5351

54-
resources:
55-
Resources:
56-
## Specifying the S3 Bucket
57-
WebAppS3Bucket:
58-
Type: AWS::S3::Bucket
59-
Properties:
60-
BucketName: ${self:custom.s3Bucket}
61-
AccessControl: PublicRead
62-
WebsiteConfiguration:
63-
IndexDocument: index.html
64-
ErrorDocument: index.html
65-
## Specifying the policies to make sure all files inside the Bucket are available to CloudFront
66-
WebAppS3BucketPolicy:
67-
Type: AWS::S3::BucketPolicy
68-
Properties:
69-
Bucket:
70-
Ref: WebAppS3Bucket
71-
PolicyDocument:
72-
Statement:
73-
- Sid: PublicReadGetObject
74-
Effect: Allow
75-
Principal: "*"
76-
Action:
77-
- s3:GetObject
78-
Resource: arn:aws:s3:::${self:custom.s3Bucket}/*
79-
## Specifying the CloudFront Distribution to serve your Web Application
80-
WebAppCloudFrontDistribution:
81-
Type: AWS::CloudFront::Distribution
82-
Properties:
83-
DistributionConfig:
84-
PriceClass: "PriceClass_100"
85-
Origins:
86-
- DomainName: ${self:custom.s3Bucket}.s3.amazonaws.com
87-
## An identifier for the origin which must be unique within the distribution
88-
Id: WebApp
89-
CustomOriginConfig:
90-
HTTPPort: 80
91-
HTTPSPort: 443
92-
OriginProtocolPolicy: https-only
93-
## In case you want to restrict the bucket access use S3OriginConfig and remove CustomOriginConfig
94-
# S3OriginConfig:
95-
# OriginAccessIdentity: origin-access-identity/cloudfront/E127EXAMPLE51Z
96-
Enabled: 'true'
97-
## Uncomment the following section in case you are using a custom domain
98-
Aliases:
99-
- ${param:url}
100-
DefaultRootObject: index.html
101-
## Since the Single Page App is taking care of the routing we need to make sure ever path is served with index.html
102-
## The only exception are files that actually exist e.h. app.js, reset.css
103-
CustomErrorResponses:
104-
- ErrorCode: 404
105-
ResponseCode: 200
106-
ResponsePagePath: /index.html
107-
DefaultCacheBehavior:
108-
AllowedMethods:
109-
- DELETE
110-
- GET
111-
- HEAD
112-
- OPTIONS
113-
- PATCH
114-
- POST
115-
- PUT
116-
## The origin id defined above
117-
TargetOriginId: WebApp
118-
## Defining if and how the QueryString and Cookies are forwarded to the origin which in this case is S3
119-
ForwardedValues:
120-
QueryString: 'false'
121-
Cookies:
122-
Forward: none
123-
## The protocol that users can use to access the files in the origin. To allow HTTP use `allow-all`
124-
ViewerProtocolPolicy: redirect-to-https
125-
## The certificate to use when viewers use HTTPS to request objects.
126-
ViewerCertificate:
127-
AcmCertificateArn: arn:aws:acm:us-east-1:153672715141:certificate/0138b8fd-1159-4928-a072-2eb1c999f53c
128-
SslSupportMethod: "sni-only"
129-
MinimumProtocolVersion: "TLSv1.1_2016"
130-
# CloudFrontDefaultCertificate: 'true'
131-
## Uncomment the following section in case you want to enable logging for CloudFront requests
132-
# Logging:
133-
# IncludeCookies: 'false'
134-
# Bucket: mylogs.s3.amazonaws.com
135-
# Prefix: myprefix
52+
objectHeaders:
53+
# Cache-bustable assets (fingerprinted)
54+
"static/**/*":
55+
- name: Cache-Control
56+
value: "public, max-age=31536000, immutable"
57+
58+
"flags/**/*":
59+
- name: Cache-Control
60+
value: "public, max-age=31536000, immutable"
61+
62+
# HTML should never be cached
63+
"index.html":
64+
- name: Cache-Control
65+
value: "no-cache, no-store, must-revalidate"
13666

137-
## In order to print out the hosted domain via `serverless info` we need to define the DomainName output for CloudFormation
138-
Outputs:
139-
WebAppS3BucketOutput:
140-
Value:
141-
'Ref': WebAppS3Bucket
142-
WebAppCloudFrontDistributionOutput:
143-
Value:
144-
'Fn::GetAtt': [ WebAppCloudFrontDistribution, DomainName ]
67+
"error.html":
68+
- name: Cache-Control
69+
value: "no-cache, no-store, must-revalidate"
70+
71+
# Optional: catch-all fallback
72+
ALL_OBJECTS:
73+
- name: Cache-Control
74+
value: "public, max-age=3600"
75+
76+
# s3LocalPath: C:\Projects\AbstractPlay\front\build\
77+
s3LocalPath: ./build/

0 commit comments

Comments
 (0)