Jelajahi Sumber

【修复】优化版本检查流程

- 从 index.html 中更新版本号至 1.18.8
- 优化 get-version.bash 脚本,解决多行文件导致的版本提取问题
- 移除 release.yml 中不必要的脚本权限设置步骤
PJ568 1 tahun lalu
induk
melakukan
e21b1c8aa9
4 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 0 2
      .github/workflows/release.yml
  2. 1 1
      index.html
  3. 2 1
      scripts/get-version.bash
  4. 0 0
      scripts/is-newer-version.bash

+ 0 - 2
.github/workflows/release.yml

@@ -21,8 +21,6 @@ jobs:
     - name: Check version
       id: version-check
       run: |
-        chmod +x ./scripts/is-newer-version.bash
-        chmod +x ./scripts/get-version.bash
         VERSION=$(./scripts/is-newer-version.bash)
         echo "version=${VERSION}" >> $GITHUB_OUTPUT
         if [ "$VERSION" != "0" ]; then

+ 1 - 1
index.html

@@ -2,7 +2,7 @@
 
 <html>
   <markdown-html
-    version="1.18.7"
+    version="1.18.8"
     author="PJ568"
     repo="https://github.com/PJ-568/markdown.html"
     license="CC BY-SA 4.0 International"

+ 2 - 1
scripts/get-version.bash

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

+ 0 - 0
scripts/is-newer-version.bash