Horis 2 лет назад
Родитель
Сommit
73009e2995

+ 4 - 2
.github/workflows/test.yml

@@ -148,6 +148,10 @@ jobs:
           if-no-files-found: ignore
           path: ${{ github.workspace }}/mapping/mapping.txt
 
+      - name: Delete Pre-Release
+        if: env.type == 'release'
+        run: gh release delete beta -y --cleanup-tag
+
       - name: Publish Pre-Release
         if: env.type == 'release'
         uses: ncipollo/release-action@v1
@@ -156,8 +160,6 @@ jobs:
           tag: "beta"
           body: "此版本为测试版,可能存在不稳定情况,升级前请务必备份好数据。"
           prerelease: true
-          removeArtifacts: true
-          allowUpdates: true
           artifacts: ${{ github.workspace }}/app/build/outputs/apk/*/*/*.apk
 
   lanzou:

+ 6 - 6
app/src/main/java/io/legado/app/help/AppUpdateGitHub.kt

@@ -58,14 +58,14 @@ object AppUpdateGitHub : AppUpdate.AppUpdateInterface {
             }
             val rootDoc = jsonPath.parse(body)
             val path = "\$.assets[?(@.name =~ /legado_${appCtx.channel}_.*?apk\$/)]"
-            val assetsMap = rootDoc.read<List<Any>>(path)
-                .firstOrNull()
+            val name = rootDoc.readString("$.name")
                 ?: throw NoStackTraceException("获取新版本出错")
-            val assets = jsonPath.parse(assetsMap)
-            val name = assets.readString("$.name")
-                ?: throw NoStackTraceException("获取新版本出错")
-            val tagName = name.replace("legado_${appCtx.channel}_|\\.apk".toRegex(), "")
+            val tagName = name.replace("legado_${appCtx.channel}_", "")
             if (tagName > AppConst.appInfo.versionName) {
+                val assetsMap = rootDoc.read<List<Any>>(path)
+                    .firstOrNull()
+                    ?: throw NoStackTraceException("获取新版本出错")
+                val assets = jsonPath.parse(assetsMap)
                 val updateBody = rootDoc.readString("$.body")
                     ?: throw NoStackTraceException("获取新版本出错")
                 val downloadUrl = assets.readString("$.browser_download_url")