Files
qqbotsdk/.gitea/workflows/deploy-docs.yml
T
snowy-yang 98ed680c73 fix: 弃用 actions/checkout 改从 Gitea 本体克隆,绕开 github 间歇性不通
deploy/secrets 探测同时证实两个 secrets 均未生效(MISSING),部署
工作流此前死于 wrangler 无凭据。checkout 在四轮检测里三度嫌疑:用
它的任务多次 8~26s 即死,而没有 checkout 步骤的 probe 每次都成功,
github 探测时通时不通——典型间歇性故障。git clone 自家仓库彻底
绕开;CPython 下载仍走 npmmirror 镜像防 github 抖动。
2026-09-24 20:38:20 +08:00

48 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: 部署文档(Cloudflare Pages)
on:
push:
branches: [main]
paths:
- "index.html"
- "_sidebar.md"
- "README.md"
- "docs/**"
- "examples/**"
- "CHANGELOG.md"
- "scripts/deploy_docs.sh"
- ".gitea/workflows/deploy-docs.yml"
workflow_dispatch:
jobs:
deploy-docs:
name: Cloudflare Pages
runs-on: ubuntu-latest
steps:
# 不用 actions/checkout(runner 对 github 连通性不稳,见 probe.yml),
# 改从 Gitea 本体克隆
- name: 检出代码
run: git clone --depth=1 "${GITHUB_SERVER_URL:-https://gitea.4i.hk}/${GITHUB_REPOSITORY}.git" .
# 日志匿名不可读:把 secrets 在场情况写进 commit status 便于远程
# 排查(只报 set/MISSING,不泄露值)
- name: 探测 secrets 是否配置
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CF_ACCOUNT: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
SERVER="${GITHUB_SERVER_URL:-https://gitea.4i.hk}"
s() { [ -n "$2" ] && echo set || echo MISSING; }
curl -s -m 10 -X POST \
-H "Authorization: token $TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"state\":\"success\",\"context\":\"deploy/secrets\",\"description\":\"CLOUDFLARE_API_TOKEN=$(s x "$CF_TOKEN") CLOUDFLARE_ACCOUNT_ID=$(s x "$CF_ACCOUNT")\"}" \
"$SERVER/api/v1/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" -o /dev/null
- name: 组装并部署(wrangler Direct Upload)
run: bash scripts/deploy_docs.sh
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}