Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/mfe-s3-bucket-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ on:
description: Deployment environment (prod, stage)
type: string
required: true
BUCKET_NAME:
type: string
required: false
PUBLIC_PATH_CDN:
type: string
required: false
AWS_CLOUDFRONT_DISTRIBUTION_ID:
type: string
required: false
Copy link

@johanseto johanseto Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bucket and aws_cloudfront are attached to https://github.com/nelc/actions-hub/pull/10/files#diff-c80649a9b4831cd14c8699c5fdbe0cb4bb85eea9e979ecb99158b1bdd3b26b95R130-R132

AWS credentials(secrets), but in my opinion is ok to keep them in vars

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I don't understand your comment and the link redirects me to this comment

Copy link

@johanseto johanseto Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missed click... this only works with Cloufront using the same credentials.

aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

Copy link
Collaborator Author

@andrey-canon andrey-canon Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you're right this only allows changing the cloudfront configuration in the same aws account, it's not possible to use a different aws account


jobs:
build:
Expand Down Expand Up @@ -84,7 +93,7 @@ jobs:
- name: Build the application
run: npm run build
env:
PUBLIC_PATH: ${{ vars.PUBLIC_PATH_CDN }}
PUBLIC_PATH: ${{ inputs.PUBLIC_PATH_CDN || vars.PUBLIC_PATH_CDN }}
APP_ID: ${{ vars.APP_ID }}
MFE_CONFIG_API_URL: ${{ vars.MFE_CONFIG_API_URL }}
ENABLE_NEW_RELIC: false
Expand All @@ -102,7 +111,7 @@ jobs:
deployment:
environment:
name: ${{ inputs.ENVIRONMENT }}
url: ${{ vars.PUBLIC_PATH_CDN }}
url: ${{ inputs.PUBLIC_PATH_CDN || vars.PUBLIC_PATH_CDN }}
runs-on: ubuntu-latest
needs: build
steps:
Expand All @@ -126,10 +135,10 @@ jobs:
run: |
aws s3 sync . $S3_BUCKET --delete
env:
S3_BUCKET: s3://${{ vars.BUCKET_NAME }}/${{ vars.APP_ID }}/
S3_BUCKET: s3://${{ inputs.BUCKET_NAME || vars.BUCKET_NAME }}/${{ vars.APP_ID }}/

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--distribution-id ${{ inputs.AWS_CLOUDFRONT_DISTRIBUTION_ID || secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/${{ vars.APP_ID }}/*"
Loading