Skip to content

Commit

Permalink
fix: more info
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Sep 8, 2024
1 parent be25da4 commit c8c5ef1
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions .github/download-ROOT-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ if [ $# -ne 1 ]; then
echo "USAGE: $0 [TAG]" >&2
exit 1
fi

tag=$1
curl_cmd='curl --silent -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28"'

echo DEBUG
$curl_cmd https://api.github.com/repos/root-project/ROOT/releases/latest | jq
exit 1
get_payload() {
curl --silent -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" $1
}

echo "Download ROOT tag '$tag' from:"
echo "================================="
case $tag in
latest)
url=$($curl_cmd https://api.github.com/repos/root-project/ROOT/releases/latest | jq -r '.tarball_url')
payload=$(get_payload https://api.github.com/repos/root-project/ROOT/releases/latest)
echo $payload | jq
url=$(echo $payload | jq -r '.tarball_url')
;;
*)
url=$($curl_cmd https://api.github.com/repos/root-project/ROOT/tags | jq -r '.[] | select (.name=="'$tag'") | .tarball_url')
payload=$(get_payload https://api.github.com/repos/root-project/ROOT/tags)
echo $payload | jq
url=$(echo $payload | jq -r '.[] | select (.name=="'$tag'") | .tarball_url')
;;
esac

echo " $url"
[ -z "$url" ] && echo "ERROR: GitHub API call returned empty string, perhaps tag '$tag' does not exist?" && exit 1
echo "================================="
echo "Download ROOT tag '$tag' from:"
echo " URL = $url"
echo "used jq version: $(jq --version)"
[ -z "$url" -o "$url" = "null" ] && echo "ERROR: GitHub API payload parsing failed, perhaps tag '$tag' does not exist?" && exit 1
echo "downloading ..."
wget -nv --no-check-certificate --output-document root.tar.gz $url
# exec wget -nv --no-check-certificate --output-document root.tar.gz $url

0 comments on commit c8c5ef1

Please sign in to comment.