Update Database and Push #954
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: Update Database and Push | |
on: | |
workflow_dispatch: | |
jobs: | |
build_and_deploy_db: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout data | |
uses: actions/checkout@v4 | |
with: | |
ref: data | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install Poetry | |
run: pip install poetry | |
- name: Install dependencies | |
run: poetry install | |
- name: Run import script | |
run: | | |
git worktree add data data | |
poetry run python scripts/import.py data static/sb.duckdb.wasm | |
- name: Deploy DB to R2 | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
command: r2 object put server-radar/sb.duckdb -f static/sb.duckdb.wasm -J eu | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Push new data to worker | |
run: poetry run python scripts/push.py static/sb.duckdb.wasm | |
env: | |
API_KEY: ${{ secrets.API_KEY }} |