From 196b01b78e616c6dcf567d9709c182471ffef2cb Mon Sep 17 00:00:00 2001 From: Benjamin Cook Date: Wed, 8 May 2024 17:43:33 -0600 Subject: [PATCH] fix: github release install silently fails if no urls found --- 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]}"