From 4561ed4858e9a7ad131e7ea2e051ea1a690cff82 Mon Sep 17 00:00:00 2001 From: bcook254 <44739883+bcook254@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:00:31 -0700 Subject: [PATCH] fix: github release install silently fails if no urls found (#571) Co-authored-by: Benjamin Sherman --- github-release-install.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/github-release-install.sh b/github-release-install.sh index aa9243e0..3d726655 100755 --- a/github-release-install.sh +++ b/github-release-install.sh @@ -47,14 +47,11 @@ API="https://api.github.com/repos/${ORG_PROJ}/releases/${RELTAG}" # retry up to 5 times with 5 second delays for any error included HTTP 404 etc curl --fail --retry 5 --retry-delay 5 --retry-all-errors -sL ${API} -o ${API_JSON} -RPM_URLS=$(cat ${API_JSON} \ +RPM_URLS=($(cat ${API_JSON} \ | jq \ -r \ --arg arch_filter "${ARCH_FILTER}" \ - '.assets | sort_by(.created_at) | reverse | .[] | select(.name|test($arch_filter)) | select (.name|test("rpm$")) | .browser_download_url') -for URL in ${RPM_URLS}; do - # WARNING: in case of multiple matches, this only installs the first matched release - echo "execute: rpm-ostree install \"${URL}\"" - rpm-ostree install "${URL}" - break -done + '.assets | sort_by(.created_at) | reverse | .[] | select(.name|test($arch_filter)) | select(.name|test("rpm$")) | .browser_download_url')) +# WARNING: in case of multiple matches, this only installs the first matched release +echo "execute: rpm-ostree install \"${RPM_URLS[0]}\"" +rpm-ostree install "${RPM_URLS[0]}"