Skip to content

Commit e17f7aa

Browse files
authored
fix fetch_release_and_deploy (#4478)
1 parent b4d98b1 commit e17f7aa

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

misc/tools.func

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ fetch_and_deploy_gh_release() {
568568
fi
569569

570570
tag=$(echo "$api_response" | jq -r '.tag_name // .name // empty')
571+
[[ "$tag" =~ ^v[0-9] ]] && tag="${tag:1}"
571572
version="${tag#v}"
572573

573574
if [[ -z "$tag" ]]; then
@@ -586,8 +587,8 @@ fetch_and_deploy_gh_release() {
586587
fi
587588

588589
# Version comparison (if we already have this version, skip)
589-
if [[ "$current_version" == "$version" ]]; then
590-
$STD msg_info "Already running the latest version ($version). Skipping update."
590+
if [[ "$current_version" == "$tag" ]]; then
591+
$STD msg_info "Already running the latest version ($tag). Skipping update."
591592
return 0
592593
fi
593594

@@ -650,8 +651,15 @@ fetch_and_deploy_gh_release() {
650651

651652
# Final fallback to GitHub source tarball
652653
if [[ -z "$url" ]]; then
653-
url="https://github.com/$repo/archive/refs/tags/$version.tar.gz"
654-
$STD msg_info "Trying GitHub source tarball fallback: $url"
654+
# Use tarball_url directly from API response instead of constructing our own URL
655+
url=$(echo "$api_response" | jq -r '.tarball_url // empty')
656+
657+
# If tarball_url is empty for some reason, fall back to a constructed URL as before
658+
if [[ -z "$url" ]]; then
659+
url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz"
660+
fi
661+
662+
$STD msg_info "Using GitHub source tarball: $url"
655663
fi
656664

657665
local filename="${url##*/}"

0 commit comments

Comments
 (0)