Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deployment in staging bucket #344

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion .github/actions/deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
aws_s3_sync_args:
description: additional arguments for s3 sync command
required: true
aws_s3_cache:
description: cache value for s3 sync command
required: true
cloudfront_distribution_id:
description: the CloudFront cache id to invalidate
required: true
Expand All @@ -26,7 +29,7 @@ runs:
aws-region: eu-west-1
- name: Sync files to the bucket
run: |
aws s3 sync dist ${{ inputs.aws_deploy_path }} --delete --cache-control max-age=3600 ${{ inputs.aws_s3_sync_args }} --no-progress
aws s3 sync dist ${{ inputs.aws_deploy_path }} --delete --cache-control ${{ inputs.aws_s3_cache }} ${{ inputs.aws_s3_sync_args }} --no-progress
shell: bash
- name: Invalidate CloudFront cache
run: AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ inputs.cloudfront_distribution_id }} --paths ${{ inputs.cloudfront_invalidation_paths }}
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ jobs:
node-version: '18'
- name: Install deps, build and test project
uses: ./.github/actions/install
# - name: Deploy to staging
# if: ${{ github.ref_name == 'main' }}
# uses: ./.github/actions/deploy
# with:
# aws_role: ${{ secrets.AWS_ROLE_STAGING_ACCOUNT }}
# aws_deploy_path: ${{ secrets.AWS_STAGING_BUCKET }}
# aws_s3_sync_args: '--include \"*\" --exclude \"*/*\"'
# cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_ID_STAGING }}
# cloudfront_invalidation_paths: '/*'
- name: Deploy to staging
if: ${{ github.ref_name == 'main' }}
uses: ./.github/actions/deploy
with:
aws_role: ${{ secrets.AWS_ROLE_STAGING_ACCOUNT }}
aws_deploy_path: ${{ secrets.AWS_STAGING_BUCKET }}
aws_s3_sync_args: --include '*' --exclude '*/*'
aws_s3_cache: no-store
cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_ID_STAGING }}
cloudfront_invalidation_paths: '/*'
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
with:
aws_role: ${{ secrets.AWS_ROLE_TEST_ACCOUNT }}
aws_deploy_path: ${{ secrets.TEST_BUCKET }}/preview/${{ github.event.number }}
aws_s3_sync_args: '--include \"*\" --exclude \"*/*\"'
aws_s3_sync_args: --include '*' --exclude '*/*'
aws_s3_cache: no-store
cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_ID_TEST }}
cloudfront_invalidation_paths: '/preview/${{ github.event.number }}/*'
- name: Adding comment to PR with preview link and validation results
Expand Down
Loading