@@ -7,6 +7,15 @@ PROJECT_GH="databus23/$PROJECT_NAME"
77
88: ${HELM_PLUGIN_PATH:= " $( helm home) /plugins/helm-diff" }
99
10+ # Convert the HELM_PLUGIN_PATH to unix if cygpath is
11+ # available. This is the case when using MSYS2 or Cygwin
12+ # on Windows where helm returns a Windows path but we
13+ # need a Unix path
14+
15+ if type cygpath > /dev/null 2>&1 ; then
16+ HELM_PLUGIN_PATH=$( cygpath -u $HELM_PLUGIN_PATH )
17+ fi
18+
1019if [[ $SKIP_BIN_INSTALL == " 1" ]]; then
1120 echo " Skipping binary install"
1221 exit
@@ -32,6 +41,8 @@ initOS() {
3241 OS=$( echo ` uname` | tr ' [:upper:]' ' [:lower:]' )
3342
3443 case " $OS " in
44+ # Msys support
45+ msys* ) OS=' windows' ;;
3546 # Minimalist GNU for Windows
3647 mingw* ) OS=' windows' ;;
3748 darwin) OS=' macos' ;;
@@ -41,7 +52,7 @@ initOS() {
4152# verifySupported checks that the os/arch combination is supported for
4253# binary builds.
4354verifySupported () {
44- local supported=" linux-amd64\nmacos-amd64"
55+ local supported=" linux-amd64\nmacos-amd64\nwindows-amd64 "
4556 if ! echo " ${supported} " | grep -q " ${OS} -${ARCH} " ; then
4657 echo " No prebuild binary for ${OS} -${ARCH} ."
4758 exit 1
@@ -55,12 +66,16 @@ verifySupported() {
5566
5667# getDownloadURL checks the latest available version.
5768getDownloadURL () {
58- # Use the GitHub API to find the latest version for this project.
59- local latest_url=" https://api.github.com/repos/$PROJECT_GH /releases/latest"
69+ local url=" https://api.github.com/repos/$PROJECT_GH /releases/latest"
70+ local version=$( git describe --tags --exact-match 2> /dev/null)
71+ if [ -n " $version " ]; then
72+ url=" https://api.github.com/repos/$PROJECT_GH /releases/tags/$version "
73+ fi
74+ # Use the GitHub API to find the download url for this project.
6075 if type " curl" > /dev/null; then
61- DOWNLOAD_URL=$( curl -s $latest_url | grep $OS | awk ' /\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}' )
76+ DOWNLOAD_URL=$( curl -v - s $url | grep $OS | awk ' /\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}' )
6277 elif type " wget" > /dev/null; then
63- DOWNLOAD_URL=$( wget -q -O - $latest_url | grep $OS | awk ' /\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}' )
78+ DOWNLOAD_URL=$( wget -q -O - $url | grep $OS | awk ' /\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}' )
6479 fi
6580}
6681
0 commit comments