-
-
Notifications
You must be signed in to change notification settings - Fork 24
118 lines (107 loc) · 3.64 KB
/
test-upload.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
111
112
113
114
115
116
117
118
name: Action CI
on:
pull_request_target:
branches:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install Dependencies
run: pnpm i --frozen-lockfile
- name: Build
run: pnpm run build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: r2-upload-action
path: dist/
upload:
name: R2 Test / Upload
needs: build
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
node-version: ["lts/*"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: r2-upload-action
path: dist/
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
- name: Create test file
run: |
mkdir tests/log
echo Upload test - ${{ steps.date.outputs.date }} > "tests/log/upload-${{ steps.date.outputs.date }}"
- name: Upload to R2
uses: ./
with:
r2-account-id: ${{ secrets.TEST_R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.TEST_R2_AKID }}
r2-secret-access-key: ${{ secrets.TEST_R2_SECRET_AK }}
r2-bucket: ${{ secrets.TEST_R2_BUCKET }}
source-dir: tests/log
destination-dir: r2-upload-action/test-logs
keep-file-fresh: true
upload-multiple:
name: R2 Test / Upload Multiple
needs: upload
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
node-version: ["lts/*"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: r2-upload-action
path: dist/
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
- name: Create test file
run: |
mkdir tests/log
echo Upload test - ${{ steps.date.outputs.date }} - File 1 > "tests/log/upload-${{ steps.date.outputs.date }}-file1"
echo Upload test - ${{ steps.date.outputs.date }} - File 2 > "tests/log/upload-${{ steps.date.outputs.date }}-file2"
mkdir tests/log2
echo Upload test - ${{ steps.date.outputs.date }} - File 3 > "tests/log2/upload-${{ steps.date.outputs.date }}-file3"
echo Upload test - ${{ steps.date.outputs.date }} - File 4 > "tests/log2/upload-${{ steps.date.outputs.date }}-file4"
- name: Upload to R2
uses: ./
with:
r2-account-id: ${{ secrets.TEST_R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.TEST_R2_AKID }}
r2-secret-access-key: ${{ secrets.TEST_R2_SECRET_AK }}
r2-bucket: ${{ secrets.TEST_R2_BUCKET }}
source-dir: |
tests/log/upload-${{ steps.date.outputs.date }}-file1
tests/log/upload-${{ steps.date.outputs.date }}-file2
tests/log2
destination-dir: r2-upload-action/test-logs
keep-file-fresh: true