Skip to content

Commit e21b1c8

Browse files
committed
【修复】优化版本检查流程
- 从 index.html 中更新版本号至 1.18.8 - 优化 get-version.bash 脚本,解决多行文件导致的版本提取问题 - 移除 release.yml 中不必要的脚本权限设置步骤
1 parent 3157bf3 commit e21b1c8

5 files changed

Lines changed: 3 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
- name: Check version
2222
id: version-check
2323
run: |
24-
chmod +x ./scripts/is-newer-version.bash
25-
chmod +x ./scripts/get-version.bash
2624
VERSION=$(./scripts/is-newer-version.bash)
2725
echo "version=${VERSION}" >> $GITHUB_OUTPUT
2826
if [ "$VERSION" != "0" ]; then

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<html>
44
<markdown-html
5-
version="1.18.7"
5+
version="1.18.8"
66
author="PJ568"
77
repo="https://github.com/PJ-568/markdown.html"
88
license="CC BY-SA 4.0 International"

scripts/get-version.bash

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ if [ ! -f "$FILE_PATH" ]; then
3636
fi
3737

3838
## 从 <markdown-html> 标签中提取第一个 version 属性的值
39-
VERSION=$(grep -oP '<markdown-html\s+version="\K[^"]+' "$FILE_PATH" | head -1)
39+
# 使用 tr 删除换行符,使整个文件成为单行
40+
VERSION=$(tr -d '\n' < "$FILE_PATH" | grep -oP '<markdown-html\s+version="\K[^"]+')
4041
if [ -z "$VERSION" ]; then
4142
recho "错误:未找到版本号" "Error: Version not found"
4243
exit 1

scripts/is-newer-version.bash

100644100755
File mode changed.

scripts/release.bash

100644100755
File mode changed.

0 commit comments

Comments
 (0)