chore: fix install.sh to point at releases API (#3510)

This commit is contained in:
Mark Fine 2023-01-27 17:17:38 -08:00 committed by GitHub
parent 7071411a65
commit d57156ec22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

9
install.sh Normal file → Executable file
View File

@ -317,11 +317,14 @@ http_copy() {
github_release() {
owner_repo=$1
version=$2
test -z "$version" && version="latest"
giturl="https://github.com/${owner_repo}/releases/${version}"
if [ -z "$version" ]; then
giturl="https://api.github.com/repos/${owner_repo}/releases/latest"
else
giturl="https://api.github.com/repos/${owner_repo}/releases/tags/${version}"
fi
json=$(http_copy "$giturl" "Accept:application/json")
test -z "$json" && return 1
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
test -z "$version" && return 1
echo "$version"
}