Unverified Commit 73c3aa5b authored by Kyle Carberry's avatar Kyle Carberry Committed by GitHub
Browse files

coder: fix update script to use highest stable version (#306284)



* coder: use highest stable version not latest version

This would previously fetch 2.9.4 instead of 2.10.3 if 2.9.4 was
released afterwards. Coder frequently releases patches for older
versions, so we must sort by version.

This same pattern is done in their install script.

* Update pkgs/development/tools/coder/update.sh

Co-authored-by: default avatarsuperherointj <5861043+superherointj@users.noreply.github.com>

---------

Co-authored-by: default avatarsuperherointj <5861043+superherointj@users.noreply.github.com>
parent 14fefb3f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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')