Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thangchung/89c21402b8ffe047267a70d917d2a83e to your computer and use it in GitHub Desktop.
Save thangchung/89c21402b8ffe047267a70d917d2a83e to your computer and use it in GitHub Desktop.
#!/bin/bash
PROTOC_REPO="google/protobuf"
# Credits to: lukechilds here: https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
URL="https://api.github.com/repos/$1/releases/latest"
VERSION=$(curl --silent $URL |grep '"tag_name":' |sed -E 's/.*"([^"]+)".*/\1/')
echo $VERSION
}
LATEST_VERSION=$(get_latest_release ${PROTOC_REPO})
echo "Latest version is: ${LATEST_VERSION}"
_VERSION=${LATEST_VERSION:1}
# grab the latest version
curl -OL https://github.com/${PROTOC_REPO}/releases/download/${LATEST_VERSION}/protoc-${_VERSION}-linux-x86_64.zip
# Unzip
unzip protoc-${_VERSION}-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
sudo mv protoc3/include/* /usr/local/include/
# Optional: change owner
sudo chown $USER /usr/local/bin/protoc
sudo chown -R $USER /usr/local/include/google
exit 0
@thangchung
Copy link
Author

Then need to install dotnet core latest version as well

> sudo apt-get install apt-transport-https
> sudo apt-get update
> sudo apt-get install dotnet-sdk-2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment