forked from trustwallet/assets
-
Notifications
You must be signed in to change notification settings - Fork 17
56 lines (46 loc) · 1.61 KB
/
Copy pathupload.yml
File metadata and controls
56 lines (46 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Upload Assets to R2
on:
push:
branches:
- master
workflow_dispatch:
workflow_call:
schedule:
- cron: '0 */3 * * *'
permissions:
contents: read
concurrency:
group: upload
cancel-in-progress: false
env:
AWS_REGION: us-east-1
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.ref_name || 'master' }}
fetch-depth: 2
- name: Configure AWS credentials
run: |
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.R2_ACCESS_SECRET_KEY }}
aws configure set region ${{ env.AWS_REGION }}
- name: Sync blockchains to R2
run: |
aws s3 sync blockchains/ s3://${{ secrets.R2_ASSETS_BUCKET }}/blockchains/ \
--endpoint-url https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com \
--size-only \
--delete
- name: Sync lists to R2
run: |
aws s3 sync lists/ s3://${{ secrets.R2_ASSETS_BUCKET }}/lists/ \
--endpoint-url https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com \
--size-only \
--delete
- name: Purge cache
run: |
git show --name-only --pretty="" HEAD -- blockchains/ lists/ > /tmp/changed.txt || true
./.github/scripts/purge-cache.sh "${{ secrets.R2_PURGE_CACHE_ZONE_ID }}" "${{ secrets.R2_PURGE_CACHE_SECRET_KEY }}" "${{ secrets.R2_PURGE_CACHE_URL }}" /tmp/changed.txt