Personal Telegram developer console for GitHub

ci: add production Cloudflare deploy workflow

davoodmehraban89 committed Oct 2, 2026 at 23:25 UTC c86b86ec8f5678b9223b7bcb6a73e0377116e670
1 file changed +49
.github/workflows/deploy.yml new
+49
@@ -0,0 +1,49 @@
1 +name: Deploy Cloudflare Worker
2 +
3 +on:
4 + workflow_run:
5 + workflows: ["CI"]
6 + types: [completed]
7 +
8 +permissions:
9 + contents: read
10 +
11 +concurrency:
12 + group: deploy-production
13 + cancel-in-progress: false
14 +
15 +jobs:
16 + deploy:
17 + if: >-
18 + github.event.workflow_run.conclusion == 'success' &&
19 + github.event.workflow_run.event == 'push' &&
20 + github.event.workflow_run.head_branch == 'main'
21 + runs-on: ubuntu-latest
22 + timeout-minutes: 10
23 + steps:
24 + - name: Checkout verified main commit
25 + uses: actions/checkout@v7
26 + with:
27 + ref: ${{ github.event.workflow_run.head_sha }}
28 +
29 + - name: Setup Node
30 + uses: actions/setup-node@v7
31 + with:
32 + node-version: "22"
33 + package-manager-cache: false
34 +
35 + - name: Verify Cloudflare deployment credentials
36 + env:
37 + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
38 + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
39 + shell: bash
40 + run: |
41 + set -euo pipefail
42 + test -n "$CLOUDFLARE_API_TOKEN" || { echo "::error::Missing CLOUDFLARE_API_TOKEN repository secret"; exit 1; }
43 + test -n "$CLOUDFLARE_ACCOUNT_ID" || { echo "::error::Missing CLOUDFLARE_ACCOUNT_ID repository secret"; exit 1; }
44 +
45 + - name: Deploy verified commit to Cloudflare Workers
46 + env:
47 + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
48 + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
49 + run: npx --yes wrangler@4 deploy