Skip to content

Commit ef892df

Browse files
Merge pull request #9 from aws-samples/copy-function
build package
2 parents d10f441 + f4bc90b commit ef892df

5 files changed

Lines changed: 58 additions & 52 deletions

File tree

.github/workflows/release.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ jobs:
5151
draft: false
5252
prerelease: false
5353
# Package and Upload Archive
54+
- name: Pre-Package Copy Function
55+
run: cd source/witch/ && mkdir nodejs && npm install --prefix nodejs mime-types && cp witch.js nodejs/node_modules/ && zip -r ../../witch.zip nodejs && cd ../../
5456
- name: Pre-Package Function
5557
run: cd source/secured-headers/ && zip -r ../../s-headers.zip index.js && cd ../../
5658
- name: Package Release
5759
run: zip -r packaged.zip -@ < ci/include.lst
58-
- name: Upload Release
59-
run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-cloudfront-secure-static-site/v${{ env.THIS_VERSION }}/amazon-cloudfront-secure-static-site.zip
60-
env:
61-
CFN_BUCKET: ${{ secrets.CFN_BUCKET }}
60+
# - name: Upload Release
61+
# run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-cloudfront-secure-static-site/v${{ env.THIS_VERSION }}/amazon-cloudfront-secure-static-site.zip
62+
# env:
63+
# CFN_BUCKET: ${{ secrets.CFN_BUCKET }}

cfn-publish.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
template=templates/main.yaml
22
acl="public-read"
3-
extra_files="s-headers.zip www/index.html www/css/style.css www/404.html www/other.html"
3+
extra_files="witch.zip s-headers.zip www/index.html www/css/style.css www/404.html www/other.html"
44
bucket_name_prefix="solution-builders"
55
regions="us-east-1"

ci/include.lst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
templates
22
cfn-publish.config
3-
macro.zip
43
s-headers.zip
5-
source/website
4+
witch.zip
5+
www

templates/custom-resource.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Resources:
8282
WebsiteConfiguration:
8383
ErrorDocument: error.html
8484
IndexDocument: index.html
85+
BucketEncryption:
86+
ServerSideEncryptionConfiguration:
87+
- ServerSideEncryptionByDefault:
88+
SSEAlgorithm: AES256
8589

8690
CopyLayerVersion:
8791
Type: "AWS::Lambda::LayerVersion"

templates/main.yaml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Parameters:
1919
LayerBucket:
2020
Description: Layer bucket
2121
Type: String
22-
# SubDomain:
23-
# Description: The part of a website address before your DomainName - e.g. www or img
24-
# Type: String
25-
# Default: www
26-
# AllowedPattern: ^[^.]*$
27-
# DomainName:
28-
# Description: The part of a website address after your SubDomain - e.g. example.com
29-
# Type: String
22+
SubDomain:
23+
Description: The part of a website address before your DomainName - e.g. www or img
24+
Type: String
25+
Default: www
26+
AllowedPattern: ^[^.]*$
27+
DomainName:
28+
Description: The part of a website address after your SubDomain - e.g. example.com
29+
Type: String
3030

3131
Resources:
3232
CustomResourceStack:
@@ -40,47 +40,47 @@ Resources:
4040
- Key: Solution
4141
Value: ACFS3
4242

43-
# AcmCertificateStack:
44-
# Type: AWS::CloudFormation::Stack
45-
# Properties:
46-
# TemplateURL: ./acm-certificate.yaml
47-
# Parameters:
48-
# DomainName: !Ref DomainName
49-
# CFNCustomProvider: !GetAtt CustomResourceStack.Outputs.CFNCustomProvider
50-
# Tags:
51-
# - Key: Solution
52-
# Value: ACFS3
43+
AcmCertificateStack:
44+
Type: AWS::CloudFormation::Stack
45+
Properties:
46+
TemplateURL: ./acm-certificate.yaml
47+
Parameters:
48+
DomainName: !Ref DomainName
49+
CFNCustomProvider: !GetAtt CustomResourceStack.Outputs.CFNCustomProvider
50+
Tags:
51+
- Key: Solution
52+
Value: ACFS3
5353

54-
# CloudFrontStack:
55-
# Type: AWS::CloudFormation::Stack
56-
# Properties:
57-
# TemplateURL: ./cloudfront-site.yaml
58-
# Parameters:
59-
# CertificateArn: !GetAtt AcmCertificateStack.Outputs.CertificateArn
60-
# DomainName: !Ref DomainName
61-
# SubDomain: !Ref SubDomain
62-
# Release: !FindInMap [Solution, Constants, Version]
63-
# Tags:
64-
# - Key: Solution
65-
# Value: ACFS3
54+
CloudFrontStack:
55+
Type: AWS::CloudFormation::Stack
56+
Properties:
57+
TemplateURL: ./cloudfront-site.yaml
58+
Parameters:
59+
CertificateArn: !GetAtt AcmCertificateStack.Outputs.CertificateArn
60+
DomainName: !Ref DomainName
61+
SubDomain: !Ref SubDomain
62+
Release: !FindInMap [Solution, Constants, Version]
63+
Tags:
64+
- Key: Solution
65+
Value: ACFS3
6666

6767
Outputs:
6868
CFNCustomProvider:
6969
Value: !GetAtt CustomResourceStack.Outputs.CFNCustomProvider
70-
# CertificateArn:
71-
# Value: !GetAtt AcmCertificateStack.Outputs.CertificateArn
72-
# CFDistributionName:
73-
# Value: !GetAtt CloudFrontStack.Outputs.CloudFrontDistribution
74-
# LambdaEdgeFunctionVersion:
75-
# Value: !GetAtt CloudFrontStack.Outputs.LambdaEdgeFunctionVersion
76-
# CloudFrontDomainName:
77-
# Description: Cloudfront Distribution CNAME
78-
# Value: !GetAtt CloudFrontStack.Outputs.CloudFrontDomainName
79-
# S3BucketLogs:
80-
# Description: Logging Bucket
81-
# Value: !GetAtt CloudFrontStack.Outputs.S3BucketLogs
82-
# S3BucketRoot:
83-
# Description: Webroot Bucket
84-
# Value: !GetAtt CloudFrontStack.Outputs.S3BucketRoot
70+
CertificateArn:
71+
Value: !GetAtt AcmCertificateStack.Outputs.CertificateArn
72+
CFDistributionName:
73+
Value: !GetAtt CloudFrontStack.Outputs.CloudFrontDistribution
74+
LambdaEdgeFunctionVersion:
75+
Value: !GetAtt CloudFrontStack.Outputs.LambdaEdgeFunctionVersion
76+
CloudFrontDomainName:
77+
Description: Cloudfront Distribution CNAME
78+
Value: !GetAtt CloudFrontStack.Outputs.CloudFrontDomainName
79+
S3BucketLogs:
80+
Description: Logging Bucket
81+
Value: !GetAtt CloudFrontStack.Outputs.S3BucketLogs
82+
S3BucketRoot:
83+
Description: Webroot Bucket
84+
Value: !GetAtt CloudFrontStack.Outputs.S3BucketRoot
8585
SolutionVersion:
8686
Value: !FindInMap [Solution, Constants, Version]

0 commit comments

Comments
 (0)