|
| 1 | +name: refresh-data |
| 2 | + |
| 3 | +# Static-dump refresh (PokeAPI api-data style + git-scraping pattern). |
| 4 | +# Regenerates dump/ from the curated seed data and commits it back when it changes. |
| 5 | +# - weekly schedule keeps the static dump fresh |
| 6 | +# - runs on any change to data/ (e.g. a curated-data PR) |
| 7 | +# - manual trigger for on-demand rebuilds |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + - cron: "17 6 * * 1" # Mondays 06:17 UTC (offset minute is polite, per git-scraping) |
| 11 | + push: |
| 12 | + branches: [main] |
| 13 | + paths: |
| 14 | + - "data/**" |
| 15 | + - "app/**" |
| 16 | + - "scripts/dump.py" |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + dump: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: "3.12" |
| 31 | + cache: pip |
| 32 | + |
| 33 | + - name: Install |
| 34 | + run: pip install -e . |
| 35 | + |
| 36 | + - name: Validate seed data |
| 37 | + run: python -m scripts.validate |
| 38 | + |
| 39 | + # Data collection happens via a separate internal pipeline that publishes |
| 40 | + # curated data into data/ (PR). This workflow only re-dumps it. |
| 41 | + - name: Generate static dump |
| 42 | + run: python -m scripts.dump |
| 43 | + |
| 44 | + # Publish target depends on the public/private decision (docs/DATA_PIPELINE.md §5). |
| 45 | + # Default: keep the dump as a downloadable build artifact (works for public OR private repos). |
| 46 | + - name: Upload static dump artifact |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: techapi-static-dump |
| 50 | + path: dump/ |
| 51 | + |
| 52 | + # To serve a public static API, enable Pages and swap the step above for: |
| 53 | + # - uses: actions/upload-pages-artifact@v3 |
| 54 | + # with: { path: dump/ } |
| 55 | + # - uses: actions/deploy-pages@v4 |
| 56 | + # (requires `permissions: pages: write, id-token: write` and Settings → Pages → GitHub Actions) |
0 commit comments