Nightly Update to Data Display #100
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: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 | |
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 > ./docs/_data/s3_content.yml | |
env: | |
S3_HOST: ${{secrets.S3_HOST}} | |
S3_ACCESS_KEY: ${{secrets.S3_ACCESS_KEY}} | |
S3_SECRET_KEY: ${{secrets.S3_SECRET_KEY}} | |
- name: Upload s3_content | |
uses: actions/upload-artifact@v3 | |
with: | |
name: s3_content | |
path: ./docs/_data/s3_content.yml | |
- name: Upload RECO | |
uses: actions/upload-artifact@v3 | |
with: | |
name: RECO | |
path: ./docs/RECO/ | |
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: | | |
rm ./docs/_data/s3_content.yml | |
if [ -d ./docs/RECO ]; then rm -rf ./docs/RECO; fi | |
mkdir ./docs/RECO/ | |
- name: Download s3_content | |
uses: actions/download-artifact@v3 | |
with: | |
name: s3_content | |
path: ./docs/_data/ | |
- name: Download RECO | |
uses: actions/download-artifact@v3 | |
with: | |
name: RECO | |
path: ./docs/RECO/ | |
- 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 list in s3_content.yml and RECO/ directory" || echo "No changes to commit" | |
git push origin main |