Skip to content

Instantly share code, notes, and snippets.

@k3karthic
Created June 8, 2021 22:46
Show Gist options
  • Save k3karthic/3dce486ef0fbf4273dbf558ca9d6ba71 to your computer and use it in GitHub Desktop.
Save k3karthic/3dce486ef0fbf4273dbf558ca9d6ba71 to your computer and use it in GitHub Desktop.
Update Kotlinc
!/usr/bin/env bash
## Forked from https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
ver=$(get_latest_release "JetBrains/kotlin")
fname="kotlin-compiler-$(echo $ver).zip"
echo "Fetching $ver..."
cd /tmp
curl -OL https://github.com/JetBrains/kotlin/releases/download/v$ver/kotlin-compiler-$ver.zip
unzip $fname
rm -rf ~/bin/kotlinc
mv /tmp/kotlinc ~/bin/
rm $fname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment