Skip to content

Commit

Permalink
Templatize metadata.json
Browse files Browse the repository at this point in the history
  • Loading branch information
kamicut committed May 30, 2024
1 parent 776a7ed commit 4e11a60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
run: |
python players.py players.xml players.db
- name: Generate metadata.json
run: |
python generate_metadata.py
- name: Deploy to Fly.io using Datasette
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Expand Down
14 changes: 14 additions & 0 deletions generate_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import json
from datetime import datetime

# Read the template
with open('metadata_template.json', 'r') as template_file:
template = template_file.read()

# Fill in the template
date = datetime.utcnow().strftime('%Y-%m-%d')
metadata_content = template.replace('{{date}}', date)

# Write the filled template to metadata.json
with open('metadata.json', 'w') as metadata_file:
metadata_file.write(metadata_content)
2 changes: 1 addition & 1 deletion metadata.json → metadata_template.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "FIDE Players",
"description": "FIDE player names, ratings, and other information",
"description": "FIDE player names, ratings, and other information. Retrieved on {{date}}",
"source": "FIDE Ratings list",
"source_url": "https://ratings.fide.com/download.phtml",
"databases": {
Expand Down

0 comments on commit 4e11a60

Please sign in to comment.