Skip to content

Commit a2fee66

Browse files
authored
chore: add Flue deploy workflow on merge to production (#32772)
* [Flue] Add production deploy workflow on merge to production * [Flue] List all production secrets in secrets.required * [Flue] Rename deploy secret to CLOUDFLARE_DOCS_BOT_FLUE_DEPLOY * [Flue] Use existing CLOUDFLARE_API_TOKEN secret for deploy * [Flue] Fix review findings: remove redundant build step, add curl failure handling * [Flue] Fix review findings: restrict workflow_dispatch branch, remove non-secret and unused entries from secrets.required * [Flue] Fix review findings: correct Google Chat link syntax, remove unused DOCS_FLUE_CF_TOKEN secret * [Flue] Revert to Google Chat pipe link syntax in failure notification
1 parent 13b68dc commit a2fee66

4 files changed

Lines changed: 72 additions & 1 deletion

File tree

.flue/wrangler.jsonc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,15 @@
189189
"head_sampling_rate": 1,
190190
},
191191
},
192+
"secrets": {
193+
"required": [
194+
"DOCS_FLUE_AI_GATEWAY_ID",
195+
"DOCS_FLUE_GITHUB_APP_ID",
196+
"DOCS_FLUE_GITHUB_APP_PRIVATE_KEY",
197+
"DOCS_FLUE_GITHUB_INSTALLATION_ID",
198+
"GITHUB_WEBHOOK_SECRET",
199+
"GITHUB_ORG_TOKEN",
200+
"DOCS_FLUE_INTERNAL_TOKEN",
201+
],
202+
},
192203
}

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
paths-ignore:
88
- ".flue/**"
99
- ".github/workflows/flue-ci.yml"
10+
- ".github/workflows/flue-deploy.yml"
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

.github/workflows/flue-deploy.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Flue Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- production
7+
paths:
8+
- ".flue/**"
9+
- ".github/workflows/flue-deploy.yml"
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: flue-deploy-production
14+
cancel-in-progress: false
15+
16+
jobs:
17+
deploy:
18+
if: github.repository == 'cloudflare/cloudflare-docs' && (github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/production')
19+
name: Deploy
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
steps:
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
26+
- name: Set up pnpm
27+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
28+
with:
29+
version: 11
30+
31+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
32+
with:
33+
node-version: 24.x
34+
cache: pnpm
35+
cache-dependency-path: .flue/pnpm-lock.yaml
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
working-directory: .flue
40+
41+
- name: Deploy
42+
run: pnpm run flue:deploy
43+
env:
44+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
45+
46+
- name: Notify Google Chat on failure
47+
if: failure()
48+
env:
49+
WEBHOOK_URL: ${{ secrets.CED_TEAM_ALERTS_CHANNEL_WEBHOOK }}
50+
ACTOR: ${{ github.actor }}
51+
REPO: ${{ github.repository }}
52+
RUN_ID: ${{ github.run_id }}
53+
run: |
54+
MESSAGE="❌ *Flue Deploy* workflow failed.\nActor: $ACTOR\n<https://github.com/$REPO/actions/runs/$RUN_ID|View run>"
55+
JSON_PAYLOAD=$(jq -n --arg text "$MESSAGE" '{text: $text}')
56+
57+
curl --fail --max-time 30 --silent --show-error -X POST "$WEBHOOK_URL" \
58+
-H "Content-Type: application/json" \
59+
-d "$JSON_PAYLOAD"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"flue:dev": "NODE_OPTIONS=--max-old-space-size=8192 pnpm --dir .flue exec vite dev",
3333
"flue:dev:wrangler": "pnpm --dir .flue exec vite build && cp -f .flue/.env.local .flue/dist/cloudflare_docs_flue/.dev.vars && pnpm --dir .flue exec wrangler dev --config dist/cloudflare_docs_flue/wrangler.json --remote",
3434
"flue:build": "pnpm --dir .flue exec vite build",
35-
"flue:deploy": "pnpm run flue:build && pnpm --dir .flue exec wrangler deploy --config dist/cloudflare_docs_flue/wrangler.json --secrets-file .env",
35+
"flue:deploy": "pnpm run flue:build && pnpm --dir .flue exec wrangler deploy --config dist/cloudflare_docs_flue/wrangler.json",
3636
"flue:clear-r2-pr-data:local": "tsx .flue/bin/clear-r2-pr-data.ts --local",
3737
"flue:reset:local": "rm -rf .flue/.wrangler/state .flue/.wrangler/tmp .flue/dist/cloudflare_docs_flue/.wrangler/state && echo 'Cleared local flue dev state (Durable Objects + R2). Stop the dev server before running this.'",
3838
"flue:evals": "tsx .flue/bin/run-evals.ts",

0 commit comments

Comments
 (0)