From 3e6d34e8347449656fc2941d54beac0ec62f9c39 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 3 Mar 2024 23:11:01 +0800 Subject: [PATCH] improve checkupdate --- scripts/autoupdate.lua | 6 +++--- scripts/checkupdate.lua | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/autoupdate.lua b/scripts/autoupdate.lua index 22c672598..e240a3743 100644 --- a/scripts/autoupdate.lua +++ b/scripts/autoupdate.lua @@ -84,9 +84,9 @@ function _update_version(instance, version, shasum) instance:name(), version_current, version) os.vexec("git add .") os.vexec("git commit -a -m \"Update %s to %s\"", instance:name(), version) - --os.vexec("git push %s %s:%s", repourl, branch, branch) - --os.vexec("gh pr create --label \"auto-update\" --title \"Auto-update %s to %s\" --body \"%s\" -R xmake-io/xmake-repo -B dev -H %s", - -- instance:name(), version, body, branch) + os.vexec("git push %s %s:%s", repourl, branch, branch) + os.vexec("gh pr create --label \"auto-update\" --title \"Auto-update %s to %s\" --body \"%s\" -R xmake-io/xmake-repo -B dev -H %s", + instance:name(), version, body, branch) end os.vexec("git reset --hard HEAD") os.vexec("git checkout %s", branch_current) diff --git a/scripts/checkupdate.lua b/scripts/checkupdate.lua index 838f76240..b43df0a84 100644 --- a/scripts/checkupdate.lua +++ b/scripts/checkupdate.lua @@ -85,7 +85,11 @@ function _check_version_from_github_releases(package, url) local version_latest for _, line in ipairs(list:split("\n")) do local splitinfo = line:split("%s+") + local release = splitinfo[1] local version = splitinfo[#splitinfo - 1] + if not version or not _is_valid_version(version) and _is_valid_version(release) then + version = release + end if version and _is_valid_version(version) then version_latest = version break