2020-07-22 00:48:14 +00:00
|
|
|
name: Upload S3
|
|
|
|
on:
|
|
|
|
push:
|
2021-12-17 16:45:02 +00:00
|
|
|
branches: [ master ]
|
|
|
|
|
2020-08-08 21:01:45 +00:00
|
|
|
workflow_dispatch:
|
2021-12-17 16:45:02 +00:00
|
|
|
|
2020-07-22 00:48:14 +00:00
|
|
|
jobs:
|
2020-08-06 19:17:38 +00:00
|
|
|
upload-s3:
|
2020-07-22 00:48:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-12-17 16:45:02 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2020-08-07 10:47:01 +00:00
|
|
|
- name: Upload (from main repo only)
|
|
|
|
if: github.repository_owner == 'trustwallet'
|
|
|
|
uses: jakejarvis/s3-sync-action@master
|
2020-07-22 00:48:14 +00:00
|
|
|
with:
|
2021-10-17 17:17:32 +00:00
|
|
|
args: --follow-symlinks --delete --exclude '*' --include 'dapps/*' --include 'blockchains/*' --include 'history/*' --size-only
|
2020-07-22 00:48:14 +00:00
|
|
|
env:
|
|
|
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_REGION: 'us-east-1'
|
2021-12-17 16:45:02 +00:00
|
|
|
|
|
|
|
- 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
|
2021-12-20 06:49:48 +00:00
|
|
|
if: github.repository_owner == 'trustwallet' && github.event_name == 'push' && steps.filter.outputs.paths != ''
|
2021-12-17 16:45:02 +00:00
|
|
|
uses: chetan/invalidate-cloudfront-action@v2
|
|
|
|
env:
|
2021-12-21 18:07:35 +00:00
|
|
|
PATHS: ${{ steps.filter.outputs.paths }}
|
2021-12-20 06:49:48 +00:00
|
|
|
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
|
2021-12-17 16:45:02 +00:00
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_REGION: "us-east-1"
|