Nightly Update to Data Display #85
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: | | |
rm -R ./docs/LOG/ | |
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 LOG | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LOG | |
path: ./docs/LOG/ | |
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 | |
rm -R ./docs/LOG/ | |
mkdir ./docs/LOG/ | |
- name: Download s3_content | |
uses: actions/download-artifact@v3 | |
with: | |
name: s3_content | |
path: ./docs/_data/ | |
- name: Download LOG | |
uses: actions/download-artifact@v3 | |
with: | |
name: LOG | |
path: ./docs/LOG/ | |
- 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 LOG/ directory" || echo "No changes to commit" | |
git push origin main |