Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ jobs:
working-directory: dashboard
run: npm ci

- name: Inject Database ID into wrangler.jsonc
env:
DB_ID: ${{ secrets.CLOUDFLARE_D1_DATABASE_ID }}
run: |
# Use jq to update the database_id inside the d1_databases array
npx strip-json-comments-cli wrangler.jsonc | jq '.d1_databases[0].database_id = env.DB_ID' > wrangler.json.tmp

# Replace the old file with the newly updated one
mv wrangler.json.tmp wrangler.jsonc

- name: Deploy Worker + assets
if: github.ref == 'refs/heads/main'
run: npx wrangler deploy --define CLOUDFLARE_D1_DATABASE_ID:"${CLOUDFLARE_D1_DATABASE_ID}"
run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_D1_DATABASE_ID: ${{ secrets.CLOUDFLARE_D1_DATABASE_ID }}
1 change: 0 additions & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
{
"binding": "DB",
"database_name": "coverage",
"database_id": "$CLOUDFLARE_D1_DATABASE_ID",
"migrations_dir": "migrations"
}
],
Expand Down
Loading