-
-
Notifications
You must be signed in to change notification settings - Fork 21
56 lines (48 loc) · 1.56 KB
/
upload_audio_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
name: Upload to R2
on:
push:
branches:
- main
- deploy
paths:
- 'audio/**'
# Triggers the workflow on pull request event, but only for pull request from not forked repo
pull_request:
types:
- opened
- synchronize
paths:
- 'audio/**'
permissions:
# default contents: read & write (in forked repos, only read)
contents: write
# default deployments: read & write (in forked repos, only read)
deployments: write
# default pull-requests: read & write (in forked repos, only read)
pull-requests: write
env:
NODE_VERSION: 20.x
CF_PAGES_PROJECT_NAME: rail-announcements
jobs:
r2_upload:
runs-on: ubuntu-latest
name: Upload Audio to Cloudflare R2
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}
- name: Upload audio files to Cloudflare R2
# If it's a PR, only run if the PR head is not a fork
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
run: |
rclone --fast-list -v --transfers=128 --checkers=256 --progress copy "./audio" "Cloudflare R2:/rail-announcements-audio"
env:
RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASSWORD }}