Compare commits

...

2 Commits

Author SHA1 Message Date
wangjia fdc13ea06c fix(ci): client release-deploy 挪到 nas runner + 等全平台构建
Deploy Client / build-windows (push) Successful in 1m41s
Deploy Client / build-android (push) Successful in 4m40s
Deploy Client / build-macos (push) Successful in 7m30s
Deploy Client / build-ios (push) Failing after 11m51s
Deploy Client / release-deploy (push) Has been skipped
client-v1.1.1 首跑:4 平台 build 全绿,但 release-deploy 卡在「Release →
Forgejo」curl exit 28(超时,3m3s=release_ensure 60s×3 重试耗尽)。根因:
release-deploy `runs-on: mac`(mac-pangolin-2)访问 git.51yanmei.com 走 frps
隧道 → 抖断。deploy-server/deploy-site 同类 Forgejo release 步跑在
ubuntu-latest(nas act_runner,与 gitea 同机/同网)稳定通过(server 仅 13s)。

- runs-on: mac → ubuntu-latest:release-deploy 全为网络/SSH 步骤(下载产物/
  传 Forgejo/SSH pangolin1/通知),无 mac 专属需求,挪到 nas runner 走本地。
- needs: [build-android] → [build-android, build-windows, build-macos, build-ios]:
  等全部平台 build 完再发布,修旧竞态(只等 android → macos/ios 产物没传就发布
  漏平台)。macos/ios 保留 continue-on-error,失败不阻断已成功平台。
- 更新过时注释(原称 Apple secret 未配 / needs 仅 android+windows)。

yaml 校验通过。build 四平台本身已在 run 639 全绿,本次只修发布环节。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
2026-08-01 23:47:29 +08:00
wangjia f0f845c6e5 fix(ci): site 流水线加 npm 国内镜像(GFW)+ npm ci 重试
Deploy Site / deploy-site (push) Successful in 2m6s
Deploy Client / build-windows (push) Successful in 1m43s
Deploy Client / build-android (push) Successful in 20m37s
Deploy Client / build-macos (push) Successful in 8m19s
Deploy Client / build-ios (push) Successful in 5m29s
Deploy Client / release-deploy (push) Failing after 24m14s
site pipeline(deploy-site.yml:Astro 官网 + Next.js 用户中心 + npx wrangler)
在墙内 nas runner 上 npm ci / npx wrangler@4 直连 registry.npmjs.org → 慢/抖断。
_env.sh 早有 Go(goproxy.cn)/Flutter(flutter-io.cn)镜像,唯独漏了 npm,且 3 个
site 脚本根本没 source _env.sh。上次「修外网发版 GFW 坑」只覆盖 android(gradle)/
windows(maven),site 这块遗漏。

- _env.sh:加 NPM_CONFIG_REGISTRY=registry.npmmirror.com(可 env 覆盖)+ npm_ci_retry
  助手(照 flutter_pub_get_retry,5 次重试)。
- compile-site.sh / compile-usercenter.sh:source _env.sh,npm ci → npm_ci_retry。
- deploy-site.sh:source _env.sh,让 npx wrangler@4 也走镜像拉包。

本地实跑 compile-site.sh:镜像生效、Astro 构建成功、dist/ 产物齐全(index.html 48K
+ 多语言目录)。shellcheck -x 全 clean。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
2026-08-01 20:32:37 +08:00
5 changed files with 50 additions and 27 deletions
+19 -21
View File
@@ -90,25 +90,16 @@ jobs:
name: windows
path: dist/
# Why build-macos/build-ios don't block the working android+windows pipeline
# when Apple secrets aren't configured yet (they aren't, as of this writing):
# 1. release-deploy's `needs:` below is [build-android, build-windows]
# ONLY — macOS/iOS are NOT dependencies, so release-deploy never waits
# on them and never fails because of them.
# 2. `continue-on-error: true` on both jobs keeps the overall workflow-run
# status green even while compile-macos.sh hard-fails (Apple Developer
# ID / notary secrets absent — see its fail-fast checks) — that failure
# is real signal ("go configure the secrets"), but it shouldn't read as
# "the release pipeline is broken" when android+windows shipped fine.
# 3. compile-macos.sh's own default behavior is to hard-fail (not skip)
# when its secrets are missing (macOS distribution must never ship
# unsigned/unnotarized — see its header comment); compile-ios.sh's
# default is to skip gracefully (exit 0) since an unconfigured iOS
# account is a normal "not set up yet" state, not a defect. Either way
# the job produces no dist/pangolin-macos-x64.zip, and
# release-deploy's "Download all artifacts" step (no `name:` filter)
# simply picks up whatever artifacts DO exist — an absent "macos"
# artifact is not an error there.
# build-macos/build-ios 用 `continue-on-error: true` → 即便 Apple 侧构建抖了
# (frps 拉 sing-box 源码 / 公证超时等),也不阻塞 android+windows 发布:
# 1. release-deploy 现在 `needs:` 全部四个平台(见下),所以它会**等**全部
# build 完成再发布 —— 避免旧 `needs: [build-android]` 只等 android、
# macos/ios 还没传产物就发布导致漏平台的竞态。
# 2. continue-on-error 让 macos/ios 失败仍算「completed」满足 needs,不使整个
# workflow 变红、不阻断已成功平台的发布;release-deploy 的「Download all
# artifacts」(无 name 过滤)只捡实际存在的产物,缺某平台不报错。
# 3. Apple 签名 secret 现已在 gitea 用户级配齐(DEVELOPER_ID_P12/IOS_DIST_P12/
# APPSTORE_API_* 等),macos/ios 正常应成功;continue-on-error 只是抖动兜底。
build-macos:
runs-on: mac
continue-on-error: true
@@ -177,8 +168,15 @@ jobs:
# dist-raw/ 里"当时存在"的产物。windows 机离线 / Apple secret 未配 都不阻塞发版
# (对应平台下载保留 pangolin1 上一版,待可用时下个 client-v* 追上)。
release-deploy:
needs: [build-android]
runs-on: mac
# 等全部平台 build 完再发布,否则 download-artifact 会漏掉尚未上传的平台
# (原来只 needs build-android → android 一完就发,macos/ios 常还没传产物)。
needs: [build-android, build-windows, build-macos, build-ios]
# ubuntu-latest = 家里 nas act_runner,与 gitea 同机/同网:Release → Forgejo 的
# API 调用走本地不过 frps 隧道(mac runner 走 git.51yanmei.com→frps→抖,curl 超时
# exit 28,3m3s=release_ensure 60s×3 重试耗尽)。deploy-server/deploy-site 同为
# ubuntu-latest,其 Forgejo release 步稳定通过(server 仅 13s)。此 job 全为网络/
# SSH 步骤(下载产物/传 Forgejo/SSH pangolin1/通知),无 mac 专属需求。
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
+16
View File
@@ -6,6 +6,9 @@
export GOPROXY="${GOPROXY:-https://goproxy.cn,direct}"
export PUB_HOSTED_URL="${PUB_HOSTED_URL:-https://pub.flutter-io.cn}"
export FLUTTER_STORAGE_BASE_URL="${FLUTTER_STORAGE_BASE_URL:-https://storage.flutter-io.cn}"
# npm/npx 国内镜像:site 流水线(Astro 官网 + Next.js 用户中心 + npx wrangler)在
# 墙内 nas runner 上直连 registry.npmjs.org 会慢/抖断,与 Go/Flutter 同样需镜像。
export NPM_CONFIG_REGISTRY="${NPM_CONFIG_REGISTRY:-https://registry.npmmirror.com}"
# Forgejo/Gitea repo coordinates (used by lib-forgejo.sh). Secrets
# FORGEJO_TOKEN / FORGEJO_URL are injected by the CI runner, not set here.
@@ -44,3 +47,16 @@ flutter_pub_get_retry() {
echo "==> flutter pub get 5 次仍失败,放弃" >&2
return 1
}
# npm_ci_retry — 同理:npmmirror 偶发抖断时重试 `npm ci`。在含 package-lock.json 的
# 目录调用(site 各 web 子项目根)。已由 NPM_CONFIG_REGISTRY 指向国内镜像。
npm_ci_retry() {
local i
for i in 1 2 3 4 5; do
if npm ci; then return 0; fi
echo "==> npm ci 失败(第 ${i}/5 次,registry 抖?),8s 后重试..." >&2
sleep 8
done
echo "==> npm ci 5 次仍失败,放弃" >&2
return 1
}
+7 -4
View File
@@ -4,16 +4,19 @@
# web/website/astro.config.mjs) — must match the deploy target host name so
# canonical URLs / sitemap resolve correctly.
#
# Run inside a node:20 container by .gitea/workflows/deploy-site.yml; this
# script itself just runs npm and assumes it is invoked from the repo root.
# 由 .gitea/workflows/deploy-site.yml 在 ubuntu runner 上从 repo 根调用(runner
# 镜像自带 node/npx,直接跑)。source _env.sh 取 npm 国内镜像 + 重试助手(墙内)。
set -euo pipefail
# shellcheck source=scripts/ci/_env.sh
. scripts/ci/_env.sh
SITE_URL="${SITE_URL:-https://pangolin.yanmeiai.com}"
export SITE_URL
echo "==> compile-site: SITE_URL=${SITE_URL}"
echo "==> compile-site: SITE_URL=${SITE_URL} NPM_CONFIG_REGISTRY=${NPM_CONFIG_REGISTRY}"
cd web/website
npm ci
npm_ci_retry
npm run build
echo "==> compile-site: done — dist/ contents:"
+5 -2
View File
@@ -11,12 +11,15 @@
# 由 .gitea/workflows/deploy-site.yml 在 ubuntu runner 上调用,从 repo 根运行。
set -euo pipefail
# shellcheck source=scripts/ci/_env.sh
. scripts/ci/_env.sh
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}"
echo "==> compile-usercenter: API_MODE=${NEXT_PUBLIC_API_MODE} API_DOMAINS=${NEXT_PUBLIC_API_DOMAINS} NPM_CONFIG_REGISTRY=${NPM_CONFIG_REGISTRY}"
cd web/usercenter
npm ci
npm_ci_retry
npm run build
echo "==> compile-usercenter: done — out/ contents:"
+3
View File
@@ -10,6 +10,9 @@
# 由 compile-site.sh 先产出 web/website/dist/;从 repo 根调用。
set -euo pipefail
# shellcheck source=scripts/ci/_env.sh
. scripts/ci/_env.sh # NPM_CONFIG_REGISTRY:让 `npx wrangler@4` 从国内镜像拉包
if [ ! -d web/website/dist ]; then
echo "==> deploy-site: web/website/dist/ 不存在 — 拒绝部署" >&2
exit 1