Unverified Commit 5610faa0 authored by superherointj's avatar superherointj Committed by GitHub
Browse files

Merge pull request #307866 from kylecarbs/master

coder: fix update.sh for stable release
parents 3b7dfff0 e866acb9
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -5,11 +5,10 @@ set -eu -o pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"

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')
LATEST_MAINLINE_VERSION=$(echo ${LATEST_MAINLINE_TAG} | sed 's/^v//')
# The released tagged as "latest" is always stable.
LATEST_STABLE_VERSION=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --fail -sSL https://api.github.com/repos/coder/coder/releases/latest | jq -r '.tag_name | sub("^v"; "")')
# The highest version that is not a pre-release is the latest mainline version.
LATEST_MAINLINE_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"; "")')

# Define the platforms
declare -A ARCHS=(["x86_64-linux"]="linux_amd64.tar.gz"