Generate and Publish Database #7
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: Generate and Publish Database | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC | |
workflow_dispatch: | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Download XML zip file | |
run: | | |
curl -O http://ratings.fide.com/download/players_list_xml.zip | |
- name: Unzip XML file | |
run: | | |
unzip players_list_xml.zip -d ./ | |
mv players_list_xml_foa.xml players.xml | |
- name: Generate SQLite database | |
run: | | |
python players.py players.xml players.db | |
- name: Generate metadata.json | |
run: | | |
python generate_metadata.py | |
- name: Install Flyctl | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy to Fly.io using Datasette | |
run: | | |
datasette publish fly players.db --app="fide-players" -m metadata.json --install=datasette-plot |