Skip to content

Commit 0773b08

Browse files
committed
feat: Seperated server validation and uploading workflows
1 parent 6e12e77 commit 0773b08

2 files changed

Lines changed: 35 additions & 19 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Upload Servers
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
upload-servers-json:
10+
needs: validate-servers-json
11+
if: github.ref == 'refs/heads/main'
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.8
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r scripts/requirements.txt
23+
- name: Validate servers & create index
24+
run: |
25+
python scripts/create_index.py
26+
27+
- name: Upload to R2
28+
env:
29+
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
30+
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
31+
AWS_DEFAULT_REGION: 'us-east-1'
32+
AWS_S3_BUCKET_NAME: 'server-repository'
33+
CF_R2_URL: ${{ secrets.CF_R2_URL }}
34+
run: |
35+
aws s3 cp servers.json s3://${AWS_S3_BUCKET_NAME}/servers.json --endpoint-url https://${CF_R2_URL} --content-type "application/json" --cache-control "public, max-age=86400"

.github/workflows/validate-servers.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
pull_request:
55
branches:
66
- main
7-
push:
8-
branches:
9-
- main
107

118
jobs:
129
validate-servers-json:
@@ -25,19 +22,3 @@ jobs:
2522
- name: Validate servers & create index
2623
run: |
2724
python scripts/create_index.py
28-
29-
upload-servers-json:
30-
needs: validate-servers-json
31-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32-
runs-on: ubuntu-latest
33-
34-
steps:
35-
- name: Upload to R2
36-
env:
37-
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
38-
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
39-
AWS_DEFAULT_REGION: 'us-east-1'
40-
AWS_S3_BUCKET_NAME: 'server-repository'
41-
CF_R2_URL: ${{ secrets.CF_R2_URL }}
42-
run: |
43-
aws s3 cp servers.json s3://${AWS_S3_BUCKET_NAME}/servers.json --endpoint-url https://${CF_R2_URL} --content-type "application/json" --cache-control "public, max-age=86400"

0 commit comments

Comments
 (0)