Skip to content

Commit

Permalink
Passes CloudFront domain to function when NoDomain is set (#10)
Browse files Browse the repository at this point in the history
* Passes CloudFront domain to function

When NoDomain is set

* Adds repo name tag and JPEG upload to PR deploy
  • Loading branch information
Phuurl authored Apr 24, 2022
1 parent 5438acc commit 9579499
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
sed -i -e "s|s3_bucket = \"{}\"|s3_bucket = \"${SAM_BUCKET}\"|g" samconfig.toml
sed -i -e "s|s3_prefix = \"{}\"|s3_prefix = \"GITHUB-Phuurl-img-site-PR-${PRNUM}\"|g" samconfig.toml
sed -i -e "s|parameter_overrides = \"{}\"|parameter_overrides = \"UploadBucketName=\\\\\"github-phuurl-img-site-pr-upload-${PRNUM}\\\\\" EmailNotificationEnabled=\\\\\"false\\\\\" NotificationEmail=\\\\\"x\\\\\" SiteName=\\\\\"GITHUB-Phuurl-img-site-PR-${PRNUM}\\\\\" NoDomain=\\\\\"true\\\\\" Domain=\\\\\"x\\\\\" CertArn=\\\\\"x\\\\\" CloudFrontRedirectFunctionName=\\\\\"GITHUB_Phuurl_img_site_PR_${PRNUM}_index_redirect_func\\\\\" CloudFrontCachePolicyName=\\\\\"GITHUB-Phuurl-img-site-PR-${PRNUM}-cache-policy\\\\\" CreateUploadIamUser=\\\\\"false\\\\\"\"|g" samconfig.toml
sed -i -e "s|tags = \"{}\"|tags = \"project=\\\\\"github\\\\\" pr=\\\\\"${PRNUM}\\\\\"\"|g" samconfig.toml
sed -i -e "s|tags = \"{}\"|tags = \"project=\\\\\"github\\\\\" repo=\\\\\"img-site\\\\\" pr=\\\\\"${PRNUM}\\\\\"\"|g" samconfig.toml
cat samconfig.toml
env:
PRNUM: ${{ github.event.number }}
Expand All @@ -89,9 +89,10 @@ jobs:
aws s3 cp robots.txt s3://${HostingBucketName}/
env:
PRNUM: ${{ github.event.number }}
- name: Upload input image
- name: Upload input images
run: |
UploadBucketName=$(aws cloudformation describe-stacks --stack-name "GITHUB-Phuurl-img-site-PR-${PRNUM}" --query "Stacks[0].Outputs[?OutputKey=='UploadBucketName'].OutputValue" --output text --region eu-west-1)
aws s3 cp ingest-fn/.test-resources/500x500.png s3://${UploadBucketName}/
aws s3 cp ingest-fn/.test-resources/500x500.jpg s3://${UploadBucketName}/
env:
PRNUM: ${{ github.event.number }}
6 changes: 5 additions & 1 deletion template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ Resources:
Variables:
HOSTING_BUCKET: !Ref HostingBucket
SITE_NAME: !Ref SiteName
DOMAIN: !Ref Domain
DOMAIN:
!If
- CloudFrontNoDomain
- !GetAtt CloudFrontDistribution.DomainName
- !Ref Domain
SNS_TOPIC_ARN: !Ref NotificationTopic
Metadata:
BuildMethod: makefile
Expand Down

0 comments on commit 9579499

Please sign in to comment.