diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2e9d273..717f36d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -70,15 +70,11 @@ jobs: bundle exec rake build - name: Validate Outputs - uses: actions/github-script@v6 - with: - script: | - const bucketName = steps.terragrunt_output.outputs.bucket_name; - const distributionId = steps.terragrunt_output.outputs.distribution_id; - - if (!bucketName || !distributionId) { - core.setFailed('Required outputs not found'); - } + run: | + echo "Verifying CloudFront Distribution..." + aws cloudfront get-distribution --id "${{ steps.terragrunt_output.outputs.distribution_id }}" + echo "\nVerifying S3 Bucket..." + aws s3 ls | grep "${{ steps.terragrunt_output.outputs.bucket_name }}" - name: Copy output to S3 run: aws s3 sync ./_site/ s3://${{ steps.terragrunt_output.outputs.bucket_name }} --acl public-read --delete --cache-control max-age=604800 diff --git a/terraform/website/main.tf b/terraform/website/main.tf index b5698a7..815ea0d 100644 --- a/terraform/website/main.tf +++ b/terraform/website/main.tf @@ -38,6 +38,25 @@ resource "aws_s3_bucket_website_configuration" "bucket" { error_document { key = "error.html" } + + routing_rules = jsonencode([ + { + Condition { + KeyPrefixEquals = "colorcop/download" + } + Redirect { + ReplaceKeyWith = "download" + } + }, + { + Condition { + KeyPrefixEquals = "colorcop/features" + } + Redirect { + ReplaceKeyWith = "features" + } + } +]) } resource "aws_cloudfront_distribution" "distribution" {