From 74aab13e3eb9c0f4a87eef2a78894216984d5b41 Mon Sep 17 00:00:00 2001 From: Harshit Mehta Date: Thu, 5 Jan 2023 17:12:47 +0530 Subject: [PATCH] Use github api to fetch latest release version (#170) * Use github api to fetch latest release version * Use grep instead of jq for querying json response Co-authored-by: Harshit Mehta --- scripts/install_plugin.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install_plugin.sh b/scripts/install_plugin.sh index a13e74f..663e5f0 100755 --- a/scripts/install_plugin.sh +++ b/scripts/install_plugin.sh @@ -4,14 +4,17 @@ name="helm-dashboard" repo="https://github.com/komodorio/${name}" +api_repo="https://api.github.com/repos/komodorio/${name}/releases/latest" if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then echo "Development mode: not downloading versioned release." exit 0 fi -version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)" -# TODO: if no version provided, get it from https://api.github.com/repos/komodorio/helm-dashboard/releases/latest +version="$(curl -X GET --header \"Accept: application/json\" ${api_repo} | grep '\"name\": "v.*\"' | cut -d 'v' -f 2 | cut -d '"' -f 1)" +[ -z "$version" ] && { + version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)" +} echo "Downloading and installing ${name} v${version} ..." url=""