From 5f872f77d6ad7f81081ebd0046b537762e0a3d2d Mon Sep 17 00:00:00 2001 From: Maksim Shilov <89912354+shilovmaksim@users.noreply.github.com> Date: Thu, 9 Dec 2021 18:39:44 +0300 Subject: [PATCH] Sorting releases and taking latest (#4703) --- images/linux/scripts/installers/kotlin.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/kotlin.sh b/images/linux/scripts/installers/kotlin.sh index 4a34f874..2b075219 100644 --- a/images/linux/scripts/installers/kotlin.sh +++ b/images/linux/scripts/installers/kotlin.sh @@ -8,7 +8,9 @@ source $HELPER_SCRIPTS/install.sh KOTLIN_ROOT="/usr/share" -URL=$(curl -s https://api.github.com/repos/JetBrains/kotlin/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kotlin-compiler"))') +kotlinReleasesUrl="https://api.github.com/repos/JetBrains/kotlin/releases" +latestRelease=$(curl -s $kotlinReleasesUrl | jq -r 'map(select(.prerelease == false)) | sort_by(.target_commitish)[-1]') +URL=$(echo $latestRelease | jq -r '.assets[].browser_download_url | select(contains("kotlin-compiler"))') download_with_retries $URL "/tmp" unzip -qq /tmp/kotlin-compiler*.zip -d $KOTLIN_ROOT