Skip to content

Commit

Permalink
ci: make tags release-* deploy to prod (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf committed Oct 27, 2023
1 parent d9530d3 commit 8040432
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/actions/deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ runs:
run: |
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 }}
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 }}
# shell: bash
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
node-version: '18'
- name: Install deps, build and test project
uses: ./.github/actions/install
# Every push to main deploys to staging
- name: Deploy to staging
if: ${{ github.ref_name == 'main' }}
uses: ./.github/actions/deploy
Expand All @@ -26,4 +27,15 @@ jobs:
aws_s3_sync_args: --include '*' --exclude '*/*'
aws_s3_cache: no-store
cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_ID_STAGING }}
cloudfront_invalidation_paths: '/*'
# Only tags named as release-* will deploy to production
- name: Deploy to prod
if: startsWith(github.ref, 'refs/tags/release-')
uses: ./.github/actions/deploy
with:
aws_role: ${{ secrets.AWS_ROLE_PRODUCTION_ACCOUNT }}
aws_deploy_path: ${{ secrets.AWS_PRODUCTION_BUCKET }}
aws_s3_sync_args: --include '*' --exclude '*/*'
aws_s3_cache: max-age=3600
cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_ID_PRODUCTION }}
cloudfront_invalidation_paths: '/*'

0 comments on commit 8040432

Please sign in to comment.