fix: relax CSP to allow SvelteKit bootstrap and Cloudflare edge scripts #13
Workflow file for this run
This file contains hidden or 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: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'dashboard/**' | |
| - 'migrations/**' | |
| - 'wrangler.jsonc' | |
| - '.github/workflows/deploy.yml' | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'dashboard/**' | |
| - 'migrations/**' | |
| - 'wrangler.jsonc' | |
| - '.github/workflows/deploy.yml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| if: github.actor != 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }} | |
| url: https://coverage-tracker.zerostash.org | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| cache-dependency-path: | | |
| package-lock.json | |
| dashboard/package-lock.json | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Install dashboard dependencies | |
| 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 | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |