fix fetch_release_and_deploy (#4478)

This commit is contained in:
Tobias 2025-05-14 16:08:21 +02:00 committed by GitHub
parent b4d98b1dd2
commit e17f7aa6f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -568,6 +568,7 @@ fetch_and_deploy_gh_release() {
fi fi
tag=$(echo "$api_response" | jq -r '.tag_name // .name // empty') tag=$(echo "$api_response" | jq -r '.tag_name // .name // empty')
[[ "$tag" =~ ^v[0-9] ]] && tag="${tag:1}"
version="${tag#v}" version="${tag#v}"
if [[ -z "$tag" ]]; then if [[ -z "$tag" ]]; then
@ -586,8 +587,8 @@ fetch_and_deploy_gh_release() {
fi fi
# Version comparison (if we already have this version, skip) # Version comparison (if we already have this version, skip)
if [[ "$current_version" == "$version" ]]; then if [[ "$current_version" == "$tag" ]]; then
$STD msg_info "Already running the latest version ($version). Skipping update." $STD msg_info "Already running the latest version ($tag). Skipping update."
return 0 return 0
fi fi
@ -650,8 +651,15 @@ fetch_and_deploy_gh_release() {
# Final fallback to GitHub source tarball # Final fallback to GitHub source tarball
if [[ -z "$url" ]]; then if [[ -z "$url" ]]; then
url="https://github.com/$repo/archive/refs/tags/$version.tar.gz" # Use tarball_url directly from API response instead of constructing our own URL
$STD msg_info "Trying GitHub source tarball fallback: $url" url=$(echo "$api_response" | jq -r '.tarball_url // empty')
# If tarball_url is empty for some reason, fall back to a constructed URL as before
if [[ -z "$url" ]]; then
url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz"
fi
$STD msg_info "Using GitHub source tarball: $url"
fi fi
local filename="${url##*/}" local filename="${url##*/}"