name: Deploy to Cloudflare Workers on: workflow_run: workflows: ["CI"] types: - completed branches: - main workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false env: WRANGLER_VERSION: "4.76.0" jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read deployments: write if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }} steps: - name: Checkout main branch uses: actions/checkout@v7 - name: Setup Node.js uses: actions/setup-node@v7 with: node-version: "24" - name: Install Wrangler CLI run: npm install --global wrangler@${{ env.WRANGLER_VERSION }} - name: Deploy to Cloudflare Workers env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} run: wrangler deploy