Scrape official database for card text #725
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
# SPDX-FileCopyrightText: © 2023 Kevin Lu | |
# SPDX-Licence-Identifier: AGPL-3.0-or-later | |
name: Scrape official database for card text | |
on: | |
workflow_dispatch: | |
schedule: | |
# 10:00 Asia/Seoul | |
- cron: "0 1 * * *" | |
jobs: | |
scrape: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.commit.outputs.status }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pip | |
- run: pip install -r src/requirements.txt | |
- run: python3 src/dump.py yugiohdb ko _site/ocg.csv | |
- run: python3 src/dump.py rushdb ko _site/rush.csv | |
- id: commit | |
uses: DawnbrandBots/.github/actions/commit-push@main | |
with: | |
message: "Scrape official Korean card database: ${{ github.run_number }} (${{ github.run_id }})" | |
- if: steps.commit.outputs.status > 0 | |
name: Add timestamp to GitHub Pages | |
run: | | |
export DATETIME=$(date -Is) | |
cat _site/index.html | DATE=$(date -I) envsubst '$DATE$DATETIME' >_site/index.html | |
echo "$DATETIME" > _site/VERSION | |
- if: steps.commit.outputs.status > 0 | |
uses: actions/configure-pages@v5 | |
- if: steps.commit.outputs.status > 0 | |
uses: actions/upload-pages-artifact@v3 | |
deploy: | |
needs: scrape | |
if: needs.scrape.outputs.status > 0 && !cancelled() | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy.outputs.page_url }} | |
steps: | |
- id: deploy | |
uses: actions/deploy-pages@v4 |