用户中心此前无 CI 部署(手动 wrangler),漂移风险。现纳入 site-v* 发版: - scripts/ci/compile-usercenter.sh:next build → out/,⚠️内置 NEXT_PUBLIC_API_MODE=http + NEXT_PUBLIC_API_DOMAINS=https://api.yanmeiai.com(不设默认 mock=假数据,是个坑) - scripts/ci/deploy-usercenter.sh:wrangler pages deploy → pangolin-usercenter (app.yanmeiai.com) - deploy-site.yml 追加两步,官网+用户中心同一 tag 发,CF token/account 走全局 secret Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
@@ -29,3 +29,14 @@ jobs:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
run: bash scripts/ci/deploy-site.sh
|
||||
|
||||
# 用户中心(web/usercenter → CF Pages pangolin-usercenter / app.yanmeiai.com)。
|
||||
# 与官网同一发版(site-v*),避免两处各自漂移。⚠️ 必须 http 模式构建(见脚本)。
|
||||
- name: Compile (用户中心 Next.js)
|
||||
run: bash scripts/ci/compile-usercenter.sh
|
||||
|
||||
- name: Deploy usercenter → Cloudflare Pages
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
run: bash scripts/ci/deploy-usercenter.sh
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# compile-usercenter.sh — build the Next.js 用户中心 (web/usercenter) as a static
|
||||
# export (output: web/usercenter/out/). Deployed to Cloudflare Pages
|
||||
# (project pangolin-usercenter, 自定义域 app.yanmeiai.com) by deploy-usercenter.sh.
|
||||
#
|
||||
# ⚠️ 必须以「真实 API」模式构建:NEXT_PUBLIC_API_MODE=http。否则 lib/api/client.ts
|
||||
# 默认落到 mock(内存假数据),部署上去登录/订阅全是演示数据。API 域名是公开信息
|
||||
# (非密钥,经 CF Tunnel 暴露的控制面),故此处内置默认值;可用同名 env 覆盖。
|
||||
#
|
||||
# 由 .gitea/workflows/deploy-site.yml 在 ubuntu runner 上调用,从 repo 根运行。
|
||||
set -euo pipefail
|
||||
|
||||
export NEXT_PUBLIC_API_MODE="${NEXT_PUBLIC_API_MODE:-http}"
|
||||
export NEXT_PUBLIC_API_DOMAINS="${NEXT_PUBLIC_API_DOMAINS:-https://api.yanmeiai.com}"
|
||||
echo "==> compile-usercenter: API_MODE=${NEXT_PUBLIC_API_MODE} API_DOMAINS=${NEXT_PUBLIC_API_DOMAINS}"
|
||||
|
||||
cd web/usercenter
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
echo "==> compile-usercenter: done — out/ contents:"
|
||||
ls -lh out/ | head
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# deploy-usercenter.sh — 部署 Next.js 用户中心 (web/usercenter/out/) 到 Cloudflare
|
||||
# Pages(项目 pangolin-usercenter,自定义域 app.yanmeiai.com)。纯静态导出,全程
|
||||
# HTTPS,不落 VPS,与节点 :443(sing-box)无冲突。
|
||||
#
|
||||
# 需环境变量:
|
||||
# CLOUDFLARE_API_TOKEN 带 Account > Cloudflare Pages > Edit 权限的 CF token
|
||||
# CLOUDFLARE_ACCOUNT_ID CF 账户 ID
|
||||
# 由 compile-usercenter.sh 先产出 web/usercenter/out/;从 repo 根调用。
|
||||
set -euo pipefail
|
||||
|
||||
if [ ! -d web/usercenter/out ]; then
|
||||
echo "==> deploy-usercenter: web/usercenter/out/ 不存在 — 拒绝部署" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! find web/usercenter/out -mindepth 1 -print -quit | grep -q .; then
|
||||
echo "==> deploy-usercenter: web/usercenter/out/ 为空 — 拒绝部署" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "${CLOUDFLARE_API_TOKEN:?deploy-usercenter: CLOUDFLARE_API_TOKEN 未设(需带 Pages:Edit)}"
|
||||
: "${CLOUDFLARE_ACCOUNT_ID:?deploy-usercenter: CLOUDFLARE_ACCOUNT_ID 未设}"
|
||||
|
||||
echo "==> deploy-usercenter: wrangler pages deploy → project pangolin-usercenter (branch main)"
|
||||
npx --yes wrangler@4 pages deploy web/usercenter/out \
|
||||
--project-name=pangolin-usercenter --branch=main --commit-dirty=true
|
||||
|
||||
echo "==> deploy-usercenter: done"
|
||||
Reference in New Issue
Block a user