Retrieve the latest .NET SDK version from restful API.
#!/usr/bin/env bash
curl -H 'Accept: application/json' https://dotnetcli.blob.core.windows.net/dotnet/Sdk/8.0/latest.version
# 8.0.300
# ... or read from global.json file
current_major_minor_patch_version=$(jq .sdk.version global.json --raw-output)
current_major_minor_version=$(cut -d '.' -f 1,2 <<< "$current_major_minor_patch_version")
latest_patch_version=$(curl -sb -H "Accept: application/json" "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$current_major_minor_version/latest.version")
echo "Current version....: $current_major_minor_patch_version"
echo "Latest version.....: $latest_patch_version"
# Current version....: 8.0.0
# Latest version.....: 8.0.300