-
Notifications
You must be signed in to change notification settings - Fork 8
110 lines (99 loc) · 3.89 KB
/
upload-to-r2.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Upload to R2
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
Sync-Root:
runs-on: ubuntu-latest
steps:
- name: Fetch
uses: neon-nyan/CollapseLauncher-ReleaseRepo/actions/r2-fetcher@main
- name: Sync Root Folder
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/folderroot
destination-dir: cl-cdn
output-file-url: false
Sync-Metadata:
runs-on: ubuntu-latest
steps:
- name: Fetch
uses: neon-nyan/CollapseLauncher-ReleaseRepo/actions/r2-fetcher@main
- name: Sync Metadata
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/metadata
destination-dir: cl-cdn/metadata
output-file-url: false
Sync-ApplyUpdate:
runs-on: ubuntu-latest
steps:
- name: Fetch
uses: neon-nyan/CollapseLauncher-ReleaseRepo/actions/r2-fetcher@main
- name: Sync Stable ApplyUpdate
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/stable
destination-dir: cl-cdn/stable
output-file-url: false
- name: Sync Preview ApplyUpdate
uses: ryand56/r2-upload-action@latest
if: always()
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/preview
destination-dir: cl-cdn/preview
output-file-url: false
Sync-Squirell:
runs-on: ubuntu-latest
steps:
- name: Fetch
uses: neon-nyan/CollapseLauncher-ReleaseRepo/actions/r2-fetcher@main
- name: Sync Squirrel\Preview folder
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/squirrel/preview
destination-dir: cl-cdn/squirrel/preview
output-file-url: false
- name: Sync Squirrel\Stable folder
uses: ryand56/r2-upload-action@latest
if: always()
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: cl-cdn/squirrel/stable
destination-dir: cl-cdn/squirrel/stable
output-file-url: false
Purge-Cache:
runs-on: ubuntu-latest
if: always() # always purge cache whenever it fails or succeed
needs: [Sync-Root, Sync-Metadata, Sync-ApplyUpdate, Sync-Squirell]
steps:
- name: Purge Cloudflare cache
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_PURGE_CACHE_ZONEID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CF_PURGE_CACHE_TOKEN }}" \
-H "Content-Type: application/json" \
--data "{ \"purge_everything\": true }"