Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions install-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ verifySupported() {

# getDownloadURL checks the latest available version.
getDownloadURL() {
local url="https://api.github.com/repos/$PROJECT_GH/releases/latest"
local version=$(git -C $HELM_PLUGIN_PATH describe --tags --exact-match 2>/dev/null)
if [ -n "$version" ]; then
url="https://api.github.com/repos/$PROJECT_GH/releases/tags/$version"
fi
# Use the GitHub API to find the download url for this project.
if type "curl" > /dev/null; then
DOWNLOAD_URL=$(curl -s $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
elif type "wget" > /dev/null; then
DOWNLOAD_URL=$(wget -q -O - $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$version/helm-diff-$OS.tgz"
else
# Use the GitHub API to find the download url for this project.
local url="https://api.github.com/repos/$PROJECT_GH/releases/latest"
if type "curl" > /dev/null; then
DOWNLOAD_URL=$(curl -s $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
elif type "wget" > /dev/null; then
DOWNLOAD_URL=$(wget -q -O - $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
fi
fi
}

Expand Down