-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (89 loc) · 2.8 KB
/
nightly-updates.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
name: Nightly Update to Data Display
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update_data:
runs-on: ubuntu-latest
container:
image: minio/mc:latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Search the database and save the file names as a list
shell: bash
run: |
if [ -d ./docs/RECO ]; then rm -rf ./docs/RECO; fi
if [ -d ./docs/FULL ]; then rm -rf ./docs/FULL; fi
mc config host add S3 ${S3_HOST} ${S3_ACCESS_KEY} ${S3_SECRET_KEY}
chmod +x ./docs/_data/list_S3.sh
./docs/_data/list_S3.sh RECO > ./docs/_data/reco_content.yml
./docs/_data/list_S3.sh FULL > ./docs/_data/full_content.yml
env:
S3_HOST: ${{secrets.S3_HOST}}
S3_ACCESS_KEY: ${{secrets.S3_ACCESS_KEY}}
S3_SECRET_KEY: ${{secrets.S3_SECRET_KEY}}
- name: Upload reco_content
uses: actions/upload-artifact@v3
with:
name: reco_content
path: ./docs/_data/reco_content.yml
- name: Upload full_content
uses: actions/upload-artifact@v3
with:
name: full_content
path: ./docs/_data/full_content.yml
- name: Upload RECO
uses: actions/upload-artifact@v3
with:
name: RECO
path: ./docs/RECO/
- name: Upload FULL
uses: actions/upload-artifact@v3
with:
name: FULL
path: ./docs/FULL/
commit_data:
needs: update_data
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Remove old s3_content
shell: bash
run: |
if [ -f ./docs/_data/reco_content.yml ]; then rm -f ./docs/_data/reco_content.yml; fi
if [ -f ./docs/_data/full_content.yml ]; then rm -f ./docs/_data/full_content.yml; fi
if [ -d ./docs/RECO ]; then rm -rf ./docs/RECO; fi
if [ -d ./docs/FULL ]; then rm -rf ./docs/FULL; fi
mkdir ./docs/RECO/
mkdir ./docs/FULL/
- name: Download reco_content
uses: actions/download-artifact@v3
with:
name: reco_content
path: ./docs/_data/
- name: Download full_content
uses: actions/download-artifact@v3
with:
name: full_content
path: ./docs/_data/
- name: Download RECO
uses: actions/download-artifact@v3
with:
name: RECO
path: ./docs/RECO/
- name: Download FULL
uses: actions/download-artifact@v3
with:
name: FULL
path: ./docs/FULL/
- name: Commit updates
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add ./docs/
git commit -m "Update summary lists in RECO and FULL directory" || echo "No changes to commit"
git push origin main