Files
XStats/Scripts/arm64_release_test.sh
T
ysicing f09861f6ec feat(release): 安装包迁移对象存储,版本号回归 semver
发布链路:安装包不再 scp 到 VPS,改用 mc 上传到对象存储
c.ysicing.net/oss/apps/macOS/XStats,上传后从 CDN 回读比对 sha256;
GitHub Release 挂 dmg 作为手动下载入口,应用内“手动下载”在未取到清单时
跳到 releases/latest。版本清单仍由自建 API 返回,publish_api.py 与
server/api 不变,且始终最后提交——安装包校验通过后客户端才看到新版本。
发布前只读校验 HEAD 与 origin/main 一致,脚本不代为 commit 或 push。

版本号:公开版本号从“年.月.日.索引”回归标准 semver,真源收敛到
CHANGELOG.md 顶部的 “## X.Y.Z · YYYY-MM-DD”;version.sh 收敛为
show/build/release 三个子命令,build 只推进构建号,删除 next 与 tag。
内部构建号改为单调递增整数(0109 规范化为 109)。日期校验回读比对,
因为 BSD date 会把 2026-02-29 规整成 2026-03-01 而非报错。

CI 不再参与发版:删除 tag 触发与 Set version from tag 步骤。

其他:appcast 的 changelog 指向本仓库而非上游站点;arm64_release_test
改用 fixture CHANGELOG,与仓库版本历史解耦;丢弃上游 0.2.0–0.6.1 的
历史条目;sync_changelog 不再改写 web/index.html(上游历史站点),
连带删除仅服务于它的 Website 段落。
2026-09-22 08:25:45 +08:00

54 lines
1.8 KiB
Bash

#!/bin/bash
# Copyright (C) 2026 ysicing
# SPDX-License-Identifier: AGPL-3.0-or-later
set -euo pipefail
cd "$(dirname "$0")/.."
compile="$(task --dry compile SIGN_ID= 2>&1)"
grep -q -- "-destination 'generic/platform=macOS' ARCHS=arm64 ONLY_ACTIVE_ARCH=NO" <<< "$compile"
if grep -q 'x86_64' <<< "$compile"; then
echo "默认构建不应包含 x86_64" >&2
exit 1
fi
if grep -q -- '^ -quiet' <<< "$compile"; then
echo "默认构建不应使用会产生 SwiftCompile 伪错误的 -quiet" >&2
exit 1
fi
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
# appcast.py 只读它自己上一级目录的 CHANGELOG.md,没有路径参数。所以把脚本复制到
# 临时目录、在那里配一份 fixture:测试从此与仓库真实的版本历史无关——归档旧版本、
# 发布新版本都不会让它失效。
mkdir -p "$WORK/repo/Scripts"
cp Scripts/appcast.py "$WORK/repo/Scripts/appcast.py"
cat > "$WORK/repo/CHANGELOG.md" <<'LOG'
# 更新日志
## 9.9.9 · 2026-01-02
### 2026-01-02
#### 新增
- 一条足够长的示例条目,用来检查摘要生成。
LOG
printf 'zip' > "$WORK/XStats-9.9.9-AppleSilicon.zip"
printf 'dmg' > "$WORK/XStats-9.9.9-AppleSilicon.dmg"
(cd "$WORK/repo" && python3 Scripts/appcast.py 9.9.9 110 https://example.test \
"$WORK/XStats-9.9.9-AppleSilicon.zip" "$WORK/XStats-9.9.9-AppleSilicon.dmg") > "$WORK/appcast.json"
python3 - "$WORK/appcast.json" <<'PY'
import json
import sys
feed = json.load(open(sys.argv[1], encoding="utf-8"))
assert "intel" not in feed, feed
assert feed["url"].endswith("-AppleSilicon.zip"), feed
assert feed["dmg"].endswith("-AppleSilicon.dmg"), feed
assert feed["notes"], feed
# 客户端点“查看更新日志”不能跳到上游 OpenStats 的站点
assert feed["changelog"] == "https://github.com/ysicing/xstats/blob/main/CHANGELOG.md", feed
PY