invlidate cloudfront on new assets upload to s3 (#16634)

* invlidate cloudfront on new assets upload to s3
This commit is contained in:
Dmytro Vorotyntsev 2021-12-17 18:45:02 +02:00 committed by GitHub
parent fcc5d0934d
commit acaa6a1fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,16 @@
name: Upload S3
on:
push:
branches:
- master
branches: [ master ]
workflow_dispatch:
jobs:
upload-s3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Upload (from main repo only)
if: github.repository_owner == 'trustwallet'
uses: jakejarvis/s3-sync-action@master
@ -19,3 +21,24 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
- name: Get changed files
uses: jitterbit/get-changed-files@v1
if: github.event_name == 'push'
id: files
- name: Filter files to invalidate
run: |
echo "::set-output name=paths::$(echo ${{ steps.files.outputs.added_modified }} | tr ' ' '\n' | grep -E 'blockchains/|dapps/' | awk '{print "/"$1}' | tr '\n' ' ')"
if: github.event_name == 'push'
id: filter
- name: Invalidate CloudFront
if: github.repository_owner == 'trustwallet' && github.event_name == 'push'
uses: chetan/invalidate-cloudfront-action@v2
env:
PATHS: ${{ steps.filter.outputs.paths }}"
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"