From 709d4ed14ac1a45f62c99c8a5d62ea1026f60ed1 Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 19 Jun 2024 17:42:19 +0800 Subject: [PATCH] fix get latest tag --- .github/workflows/data.yml | 2 +- .github/workflows/issues.yml | 2 +- files/initrd/opt/rr/menu.sh | 2 +- scripts/func.sh | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/data.yml b/.github/workflows/data.yml index 8dbfbc0f..919017c9 100644 --- a/.github/workflows/data.yml +++ b/.github/workflows/data.yml @@ -43,7 +43,7 @@ jobs: TAG="" if [ "${PRERELEASE}" = "true" ]; then - TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')" + TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" else LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")" TAG="${LATESTURL##*/}" diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 1f7d9165..c15213e1 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -151,7 +151,7 @@ jobs: TAG="" if [ "${PRERELEASE}" = "true" ]; then - TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')" + TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" else LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")" TAG="${LATESTURL##*/}" diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index 66cbdb94..f4a87a4b 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -2666,7 +2666,7 @@ function downloadExts() { TAG="" if [ "${PRERELEASE}" = "true" ]; then # TAG="$(curl -skL --connect-timeout 10 "${PROXY}${3}/tags" | pup 'a[class="Link--muted"] attr{href}' | grep ".zip" | head -1)" - TAG="$(curl -skL --connect-timeout 10 "${PROXY}${3}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')" + TAG="$(curl -skL --connect-timeout 10 "${PROXY}${3}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" else LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${PROXY}${3}/releases/latest")" TAG="${LATESTURL##*/}" diff --git a/scripts/func.sh b/scripts/func.sh index 22cc1459..3c3950fd 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -76,7 +76,7 @@ function getBuildroot() { local CACHE_FILE="/tmp/buildroot.zip" rm -f "${CACHE_FILE}" if [ "${2}" = "true" ]; then - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-buildroot/releases" | jq -r ".[0].tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-buildroot/releases" | jq -r ".[].tag_name" | sort -rV | head -1) else TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-buildroot/releases/latest" | jq -r ".tag_name") fi @@ -108,7 +108,7 @@ function getCKs() { local CACHE_FILE="/tmp/rr-cks.zip" rm -f "${CACHE_FILE}" if [ "${2}" = "true" ]; then - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-cks/releases" | jq -r ".[0].tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-cks/releases" | jq -r ".[].tag_name" | sort -rV | head -1) else TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-cks/releases/latest" | jq -r ".tag_name") fi @@ -137,7 +137,7 @@ function getLKMs() { local CACHE_FILE="/tmp/rp-lkms.zip" rm -f "${CACHE_FILE}" if [ "${2}" = "true" ]; then - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-lkms/releases" | jq -r ".[0].tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-lkms/releases" | jq -r ".[].tag_name" | sort -rV | head -1) else TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-lkms/releases/latest" | jq -r ".tag_name") fi @@ -166,7 +166,7 @@ function getAddons() { local CACHE_DIR="/tmp/addons" local CACHE_FILE="/tmp/addons.zip" if [ "${2}" = "true" ]; then - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-addons/releases" | jq -r ".[0].tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1) else TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-addons/releases/latest" | jq -r ".tag_name") fi @@ -206,7 +206,7 @@ function getModules() { local CACHE_FILE="/tmp/modules.zip" rm -f "${CACHE_FILE}" if [ "${2}" = "true" ]; then - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-modules/releases" | jq -r ".[0].tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1) else TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-modules/releases/latest" | jq -r ".tag_name") fi