ci: add GitHub Actions workflow to deploy Cloudflare Workers on push … #1
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 Cloudflare Workers | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'workers/**' | |
| - '.github/workflows/deploy-workers.yml' | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Deployment environment' | |
| required: true | |
| default: 'production' | |
| type: choice | |
| options: | |
| - production | |
| - staging | |
| jobs: | |
| deploy-verify-worker: | |
| name: Deploy authichain-verify-worker | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: workers/verify-worker | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: workers/verify-worker/package-lock.json | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| - name: Deploy to Cloudflare Workers (Production) | |
| if: github.event_name == 'push' || github.event.inputs.environment == 'production' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: workers/verify-worker | |
| command: deploy --env production | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| - name: Deploy to Cloudflare Workers (Staging) | |
| if: github.event.inputs.environment == 'staging' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: workers/verify-worker | |
| command: deploy --env staging | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| - name: Verify deployment health | |
| run: | | |
| echo "Worker deployed. Checking health endpoint..." | |
| sleep 5 | |
| curl -sf https://authichain-verify-worker.authichain2026.workers.dev/health || echo "Health check pending - worker may still be propagating" |