chore(spec): 归档 blog-5n——八任务收敛(后台深度优化全家桶)
Spec: 2026-11-05_blog-5n-admin-deep-optimization Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
a555a3e450
commit
5c0e6ed900
29 files changed
+1559
-512
No files matched your search
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# TMT 翻译构建链守卫(5n A1):包装 scripts/translate/translate_posts.py,
|
||||
# 挂在 build.sh 的 astro build 之前——中文稿保存即自动出英文版,随同次部署上线。
|
||||
#
|
||||
# 部署哲学:翻译是增益件,绝不能阻断发布——任何失败(缺凭据/缺脚本/超时/
|
||||
# TMT 报错)都只 WARN 并保留旧英文版,exit 0 让构建继续。
|
||||
# 幂等语义见 translate_posts.py 头注:源文 sha256 未变跳过(零 API 调用);
|
||||
# 译文 frontmatter locked: true 的人工润色版无条件不覆盖。
|
||||
set -u
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
SCRIPT="$REPO_ROOT/scripts/translate/translate_posts.py"
|
||||
CRED="$HOME/docker_apps/blog/tencent-translate-credentials.txt"
|
||||
TAG="[translate]"
|
||||
TIMEOUT_SECS=180
|
||||
|
||||
if [ ! -f "$SCRIPT" ]; then
|
||||
echo "$TAG SKIP 翻译脚本未就绪($SCRIPT)"
|
||||
exit 0
|
||||
fi
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "$TAG SKIP 无 python3"
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -f "$CRED" ]; then
|
||||
echo "$TAG SKIP 无 TMT 凭据($CRED),保留现有英文版"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$TAG 开始(TMT zh→en,幂等:已译且未变的源文零调用)"
|
||||
if timeout "$TIMEOUT_SECS" python3 "$SCRIPT" "$@"; then
|
||||
echo "$TAG 完成"
|
||||
else
|
||||
rc=$?
|
||||
if [ "$rc" = 124 ]; then
|
||||
echo "$TAG WARN 超时(>${TIMEOUT_SECS}s),保留旧英文版继续部署"
|
||||
else
|
||||
echo "$TAG WARN 失败(exit $rc),保留旧英文版继续部署"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
Reference in new issue
Block a user