Skip to content

Commit

Permalink
Use github api to fetch latest release version (#170)
Browse files Browse the repository at this point in the history
* Use github api to fetch latest release version

* Use grep instead of jq for querying json response

Co-authored-by: Harshit Mehta <harshitm@nvidia.com>
  • Loading branch information
harshit-mehtaa and Harshit Mehta committed Jan 5, 2023
1 parent c5cd12b commit 74aab13
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down

0 comments on commit 74aab13

Please sign in to comment.