Skip to content

refactor(workers): move api logic to dedicated worker #36

refactor(workers): move api logic to dedicated worker

refactor(workers): move api logic to dedicated worker #36

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
jobs:
worker-validate:
name: Validate Worker (dry-run)
runs-on: ubuntu-latest
defaults:
run:
working-directory: workers/api
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: workers/api/package-lock.json
- run: npm ci
- name: Worker wrangler deploy --dry-run
run: npx wrangler deploy --dry-run
deploy-worker:
name: Deploy API Worker (production)
runs-on: ubuntu-latest
needs: worker-validate
defaults:
run:
working-directory: workers/api
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: workers/api/package-lock.json
- run: npm ci
# TURNSTILE_SECRET is set out-of-band via
# `wrangler secret put TURNSTILE_SECRET` and is
# NOT passed through CI. Order matters: deploy the Worker FIRST, then
# Pages so the service binding resolves the moment the thin proxy goes live.
- name: Deploy Worker
run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
deploy:
name: Deploy to Cloudflare Pages
runs-on: ubuntu-latest
needs: deploy-worker
steps:
- uses: actions/checkout@v4
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages deploy frontend/ --project-name=notebooklm-gallery