Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local package if exist when installation #66

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
40 changes: 23 additions & 17 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,35 @@ if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
fi

version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo "Downloading and installing helm-push v${version} ..."

url=""
if [ "$(uname)" = "Darwin" ]; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_darwin_amd64.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_linux_amd64.tar.gz"
RELEASE_PACKAGE="releases/v${version}.tar.gz"
if [ ! -f ${RELEASE_PACKAGE} ]; then
echo "Downloading and installing helm-push v${version} ..."

url=""
if [ "$(uname)" = "Darwin" ]; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_darwin_amd64.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_linux_amd64.tar.gz"
else
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_windows_amd64.tar.gz"
fi

echo $url

# Download with curl if possible.
if [ -x "$(which curl 2>/dev/null)" ]; then
curl -sSL "${url}" -o ${RELEASE_PACKAGE}
else
wget -q "${url}" -O ${RELEASE_PACKAGE}
fi
else
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_windows_amd64.tar.gz"
echo "helm-push already exist..."
fi

echo $url

mkdir -p "bin"
mkdir -p "releases/v${version}"

# Download with curl if possible.
if [ -x "$(which curl 2>/dev/null)" ]; then
curl -sSL "${url}" -o "releases/v${version}.tar.gz"
else
wget -q "${url}" -O "releases/v${version}.tar.gz"
fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
tar xzf ${RELEASE_PACKAGE} -C "releases/v${version}"
mv "releases/v${version}/bin/helmpush" "bin/helmpush" || \
mv "releases/v${version}/bin/helmpush.exe" "bin/helmpush"