Update Database #1814
This file contains hidden or 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: Update Database | |
| on: | |
| watch: | |
| types: [started] | |
| schedule: | |
| - cron: 0 5 * * * | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set ENV | |
| run: | | |
| echo "RELEASE_NAME=Released on $(date +%Y%m%d)" >> $GITHUB_ENV | |
| echo "TAG_NAME=$(date +%Y%m%d)" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@master | |
| - name: Set up Python | |
| uses: actions/setup-python@master | |
| with: | |
| python-version: '3.8' | |
| - name: Install requests | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Update | |
| run: | | |
| python update.py | |
| - name: Commit | |
| run: | | |
| git config --global user.email action@github.com | |
| git config --global user.name action | |
| git add . | |
| git commit -m "Successfully update" -a --allow-empty | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
| - name: Gen Other Data Type | |
| run: | | |
| python genCSV.py | |
| - name: Delete Old Release | |
| uses: dev-drprasad/delete-older-releases@v0.2.1 | |
| with: | |
| keep_latest: 3 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
| with: | |
| name: ${{ env.RELEASE_NAME }} | |
| tag_name: ${{ env.TAG_NAME }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ./picture.db | |
| ./bing.csv | |
| ./apod.csv |