f0f845c6e5
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
33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# deploy-site.sh — 部署构建好的 Astro 官网 (web/website/dist/) 到 Cloudflare Pages。
|
|
#
|
|
# 官网托管在 CF Pages(项目 pangolin-site,自定义域 pangolin.yanmeiai.com),纯静态、
|
|
# 全程 HTTPS、CSP(_headers)自动生效,不落在 VPS 上 —— 故与节点 :443(sing-box)无冲突。
|
|
#
|
|
# 需环境变量:
|
|
# CLOUDFLARE_API_TOKEN 带 Account > Cloudflare Pages > Edit 权限的 CF token
|
|
# CLOUDFLARE_ACCOUNT_ID CF 账户 ID
|
|
# 由 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
|
|
fi
|
|
if ! find web/website/dist -mindepth 1 -print -quit | grep -q .; then
|
|
echo "==> deploy-site: web/website/dist/ 为空 — 拒绝部署" >&2
|
|
exit 1
|
|
fi
|
|
|
|
: "${CLOUDFLARE_API_TOKEN:?deploy-site: CLOUDFLARE_API_TOKEN 未设(需带 Pages:Edit)}"
|
|
: "${CLOUDFLARE_ACCOUNT_ID:?deploy-site: CLOUDFLARE_ACCOUNT_ID 未设}"
|
|
|
|
echo "==> deploy-site: wrangler pages deploy → project pangolin-site (branch main)"
|
|
npx --yes wrangler@4 pages deploy web/website/dist \
|
|
--project-name=pangolin-site --branch=main --commit-dirty=true
|
|
|
|
echo "==> deploy-site: done"
|