Nightly Update to Data Display #187
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Update to Data Display | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
update_data: | |
runs-on: ubuntu-latest | |
container: | |
image: minio/mc:RELEASE.2023-10-14T01-57-03Z | |
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 |