Merge branch 'release/0.18.9' #332
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Assets to CDN | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- '*' | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: npm install | |
- name: Build assets | |
run: npm run build | |
- name: Gzip Plugin Files | |
run: find ./dist \( -name "*.js" -o -name "*.css" \) -exec gzip -k "{}" \; | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Deploy Theme - Gzip Files | |
run: | | |
aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_PROD }}/${{ secrets.AWS_FOLDER_PATH }} --exclude '*' --include '*.gz' --delete --content-encoding 'gzip' --acl public-read | |
- name: Deploy Theme - Other Files | |
run: | | |
aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_PROD }}/${{ secrets.AWS_FOLDER_PATH }} --exclude '*.gz' --delete --acl public-read | |
- name: Invalidate S3 Assets | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_ID }} --paths "/${{ secrets.AWS_FOLDER_PATH }}*" |