Skip to content

Commit

Permalink
fix: Use the github API to get the latest release version (#553)
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Buto <[email protected]>
  • Loading branch information
cbuto authored Feb 15, 2022
1 parent dff3e90 commit ad07958
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/get-chartmuseum
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ verifySupported() {
checkDesiredVersion() {
if [ "x$DESIRED_VERSION" == "x" ]; then
# Get tag from release URL
local latest_release_url="https://github.com/helm/chartmuseum/releases"
local latest_release_url="https://api.github.com/repos/helm/chartmuseum/releases/latest"
if [ "${HAS_CURL}" == "true" ]; then
TAG=$(curl -Ls $latest_release_url | grep 'href="/helm/chartmuseum/releases/tag/v0.[0-9]*.[0-9]*\"' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
TAG=$(curl -Ls $latest_release_url | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
elif [ "${HAS_WGET}" == "true" ]; then
TAG=$(wget $latest_release_url -O - 2>&1 | grep 'href="/helm/chartmuseum/releases/tag/v0.[0-9]*.[0-9]*\"' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
TAG=$(wget $latest_release_url -O - 2>&1 | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi
else
TAG=$DESIRED_VERSION
Expand Down

0 comments on commit ad07958

Please sign in to comment.