| 1 | name: Deploy accounts worker |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main-v2] |
| 6 | paths: |
| 7 | - 'workers/accounts/**' |
| 8 | - '.github/workflows/deploy-accounts-worker.yml' |
| 9 | workflow_dispatch: |
| 10 | |
| 11 | permissions: |
| 12 | contents: read |
| 13 | |
| 14 | concurrency: |
| 15 | group: deploy-accounts-worker |
| 16 | cancel-in-progress: false |
| 17 | |
| 18 | jobs: |
| 19 | deploy: |
| 20 | runs-on: ubuntu-latest |
| 21 | steps: |
| 22 | - uses: actions/checkout@v7 |
| 23 | - uses: pnpm/action-setup@v6.0.9 |
| 24 | with: |
| 25 | version: 10 |
| 26 | run_install: false |
| 27 | - uses: actions/setup-node@v7 |
| 28 | with: |
| 29 | node-version: "24" |
| 30 | cache: pnpm |
| 31 | cache-dependency-path: workers/accounts/pnpm-lock.yaml |
| 32 | - name: Deploy |
| 33 | working-directory: workers/accounts |
| 34 | env: |
| 35 | CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
| 36 | run: | |
| 37 | pnpm install --frozen-lockfile |
| 38 | pnpm test |
| 39 | pnpm typecheck |
| 40 | npx wrangler deploy |
| 41 | - name: Sync RESEND_API_KEY to the worker |
| 42 | working-directory: workers/accounts |
| 43 | env: |
| 44 | CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
| 45 | RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} |
| 46 | run: | |
| 47 | if [ -n "$RESEND_API_KEY" ]; then |
| 48 | printf '%s' "$RESEND_API_KEY" | npx wrangler secret put RESEND_API_KEY |
| 49 | else |
| 50 | echo "RESEND_API_KEY not set in repo secrets; skipping (worker stays in stub email mode)." |
| 51 | fi |
| 52 |