mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-15 05:40:47 +08:00
The v2.5.4 notes had grown to 97 free-form entries exposed verbatim in the in-app update dialog. Distill them to 58 one-theme-per-line entries capped at ~60 CJK characters with no internal terminology, and move the writing rules into template/Changelog.md so every cycle starts from them. Release plumbing now agrees on the --- divider: extract_update_logs.sh stops there like updatelog.mjs, so file-only content never reaches release bodies, while updater.mjs appends a per-tag See More link to the update notes it generates. scripts-workflow/group_platforms.sh locks platform entries under emoji platform headings, wired into pre-commit, release and autobuild CI, and the changelog bump script; AGENTS.md points agents at the template rules.
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
#
|
||
# extract_update_logs.sh
|
||
# 从 Changelog.md 提取最新版本 (## v...) 的更新内容
|
||
# 并输出到屏幕或写入环境变量文件(如 GitHub Actions)
|
||
|
||
set -euo pipefail
|
||
|
||
CHANGELOG_FILE="Changelog.md"
|
||
|
||
if [[ ! -f "$CHANGELOG_FILE" ]]; then
|
||
echo "❌ 文件不存在: $CHANGELOG_FILE" >&2
|
||
exit 1
|
||
fi
|
||
|
||
# 提取从第一个 '## v' 开始到 '---' 或下一个 '## v' 前的内容
|
||
# '---' 与 scripts/updatelog.mjs 的解析一致:分隔线之后的内容
|
||
# 只属于仓库文件,不进入任何 release body
|
||
UPDATE_LOGS=$(awk '
|
||
/^## v/ {
|
||
if (found) exit;
|
||
found=1
|
||
}
|
||
/^---/ && found {
|
||
exit
|
||
}
|
||
found
|
||
' "$CHANGELOG_FILE")
|
||
|
||
if [[ -z "$UPDATE_LOGS" ]]; then
|
||
echo "⚠️ 未找到更新日志内容"
|
||
exit 0
|
||
fi
|
||
|
||
echo "✅ 提取到的最新版本日志内容如下:"
|
||
echo "----------------------------------------"
|
||
echo "$UPDATE_LOGS"
|
||
echo "----------------------------------------"
|
||
|
||
# 如果在 GitHub Actions 环境中(GITHUB_ENV 已定义)
|
||
if [[ -n "${GITHUB_ENV:-}" ]]; then
|
||
{
|
||
echo "UPDATE_LOGS<<EOF"
|
||
echo "$UPDATE_LOGS"
|
||
echo "EOF"
|
||
} >> "$GITHUB_ENV"
|
||
echo "✅ 已写入 GitHub 环境变量 UPDATE_LOGS"
|
||
fi
|