You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sed -i "s/\(local _VERSION_\)\( *\)\(=\) *'[^']*'/\1\2\3 '${VERSION}'/" MY_!Base/src/lib/Base.lua
76
77
77
78
- name: Update CHANGELOG.md
79
+
id: update_changelog
78
80
run: |
79
81
VERSION="${{ github.event.inputs.version }}"
80
82
CHANGELOG="${{ github.event.inputs.changelog }}"
81
83
TMPFILE=$(mktemp)
82
-
echo "# 更新日志" > $TMPFILE
84
+
echo "# 更新日志" > $TMPFILE
83
85
echo "" >> $TMPFILE
84
-
echo "## 茗伊插件集 v${VERSION}" >> $TMPFILE
85
-
echo "" >> $TMPFILE
86
-
echo "$CHANGELOG" | tr '|' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed 's/^["""]//g' | sed 's/["""]$//g' | sed 's/[::]/] /g' | sed 's/^/* [/g' >> $TMPFILE
86
+
87
+
# 智能处理更新日志内容
88
+
process_changelog() {
89
+
local input="$1"
90
+
91
+
# 首先处理原始格式 * [插件] 内容,在 * 前面添加分隔符
92
+
input=$(echo "$input" | sed 's/\([^|]\)\(\*[[:space:]]*\[\)/\1|\2/g')
93
+
94
+
# 按 | 分割每一行
95
+
echo "$input" | tr '|' '\n' | while IFS= read -r line; do
96
+
# 去掉首尾空格
97
+
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
98
+
99
+
# 去掉首尾引号
100
+
line=$(echo "$line" | sed 's/^["""]//;s/["""]$//')
101
+
102
+
# 跳过空行
103
+
[ -z "$line" ] && continue
104
+
105
+
# 检查是否已经是 * [插件] 格式
106
+
if echo "$line" | grep -q '^\*[[:space:]]*\['; then
107
+
# 已经是正确格式,只需要格式化空格
108
+
plugin=$(echo "$line" | sed 's/^\*[[:space:]]*\[\([^]]*\)\].*/\1/' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
109
+
content=$(echo "$line" | sed 's/^\*[[:space:]]*\[[^]]*\][[:space:]]*//')
110
+
echo "* [$plugin] $content"
111
+
else
112
+
# 转换 插件:内容 格式为 * [插件] 内容
113
+
if echo "$line" | grep -q '[::]'; then
114
+
plugin=$(echo "$line" | sed 's/\([^::]*\)[::].*/\1/' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed 's/^["""]//;s/["""]$//')
115
+
content=$(echo "$line" | sed 's/[^::]*[::][[:space:]]*//' | sed 's/^["""]//;s/["""]$//')
0 commit comments