This commit is contained in:
Horis
2024-07-24 16:07:30 +08:00
parent c527ac1575
commit cd37d81d21
2 changed files with 10 additions and 8 deletions

View File

@@ -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:

View File

@@ -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")