diff --git a/pkgs/development/tools/coder/update.sh b/pkgs/development/tools/coder/update.sh index ebd40e3d5adb..335c20dd55a4 100755 --- a/pkgs/development/tools/coder/update.sh +++ b/pkgs/development/tools/coder/update.sh @@ -5,9 +5,7 @@ set -eu -o pipefail cd "$(dirname "${BASH_SOURCE[0]}")" -# Fetch the latest stable version -LATEST_STABLE_TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --silent https://api.github.com/repos/coder/coder/releases/latest | jq -r '.tag_name') -LATEST_STABLE_VERSION=$(echo ${LATEST_STABLE_TAG} | sed 's/^v//') +LATEST_STABLE_VERSION=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --fail -sSL https://api.github.com/repos/coder/coder/releases | jq -r 'map(select(.prerelease == false)) | sort_by(.tag_name | sub("^v"; "") | split(".") | map(tonumber)) | .[-1].tag_name | sub("^v"; "")') # Fetch the latest mainline version LATEST_MAINLINE_TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --silent https://api.github.com/repos/coder/coder/releases | jq -r '.[0].tag_name')