fix(V0.2): 版本规则收尾 —— 手动 OTA 工作流对齐发布说明/commit 口径
Docker Build and Push / build-image (push) Successful in 1m1s

- ota-build.yml: notes 默认取检出 commit 的 message, --commit 写入
  manifest (与 docker-build 一致); 参数加引号防空格断裂
- docker-build.yml: 去掉 head -c 400 字节截断 (会把多字节汉字切成
  非法 UTF-8 导致 latest.json 解析失败), 截断统一由打包脚本按字符处理
- build-ota.mjs: CI 日志输出 build_id 与 commit
This commit is contained in:
jif2.zhang
2026-10-25 21:40:13 +08:00
parent 0f71323c11
commit 8203a7f893
3 changed files with 15 additions and 7 deletions
+3 -2
View File
@@ -85,14 +85,15 @@ jobs:
- name: Build & sign OTA package
# 每次主分支提交生成 OTA 升级包, sequence 默认时间戳 (单调递增)
# 发布说明 = 触发构建的 commit message (标题+正文, 截断 400 字),
# 发布说明 = 触发构建的 commit message (标题+正文; 打包脚本内安全截断 400 字符),
# commit sha 通过 --commit 单独写入 manifest, 前端分行展示
# 产物 ota-package/ (tar.gz + latest.json + .minisig) 进入 docker build context, 由 Dockerfile COPY 进镜像
env:
MINISIGN_PRIVATE_KEY: ${{ secrets.MINISIGN_PRIVATE_KEY }}
run: |
set -euo pipefail
MSG="$(git log -1 --pretty=format:%B | sed -e '/^[[:space:]]*$/d' | head -c 400)"
# 不用 head -c 截断: 那会把多字节汉字切成非法 UTF-8, latest.json 解析失败
MSG="$(git log -1 --pretty=format:%B | sed -e '/^[[:space:]]*$/d')"
echo "notes: ${MSG}"
node scripts/build-ota.mjs --out ota-package --notes "${MSG}" --commit "${GITHUB_SHA}" --min-binary ${OTA_MIN_BINARY}
echo "===== latest.json ====="
+10 -5
View File
@@ -66,18 +66,23 @@ jobs:
minisign -v
- name: Build & sign OTA package
# 发布说明默认 = 检出 commit 的 message (标题+正文), commit sha 单独写入;
# 手动填写的 notes 优先
env:
MINISIGN_PRIVATE_KEY: ${{ secrets.MINISIGN_PRIVATE_KEY }}
OTA_NOTES: ${{ inputs.notes }}
run: |
set -euo pipefail
OUT="ota-package"
ARGS="--out ${OUT}"
# sequence 留空 → 脚本默认用时间戳; min_binary 默认 0.1.0 (与前端版本解耦)
ARGS="--out ${OUT} --commit ${GITHUB_SHA}"
if [ -n "${{ inputs.sequence }}" ]; then ARGS="${ARGS} --sequence ${{ inputs.sequence }}"; fi
if [ -n "${OTA_NOTES}" ]; then ARGS="${ARGS} --notes ${OTA_NOTES}"; fi
if [ -n "${{ inputs.notes }}" ]; then
ARGS="${ARGS} --notes \"${{ inputs.notes }}\""
else
MSG="$(git log -1 --pretty=format:%B | sed -e '/^[[:space:]]*$/d')"
ARGS="${ARGS} --notes \"${MSG}\""
fi
if [ -n "${{ inputs.min_binary }}" ]; then ARGS="${ARGS} --min-binary ${{ inputs.min_binary }}"; fi
node scripts/build-ota.mjs ${ARGS}
eval "node scripts/build-ota.mjs ${ARGS}"
echo "===== latest.json ====="
cat ${OUT}/latest.json
echo "===== bundle sha256 ====="