Add script to update SDK version during release (#24034)

This commit is contained in:
Travis Plunk 2024-07-30 13:17:45 -07:00 committed by GitHub
parent 2a77030a0b
commit 3a6916320b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3541,3 +3541,23 @@ function Clear-NativeDependencies
$deps | ConvertTo-Json -Depth 20 | Set-Content "$PublishFolder/pwsh.deps.json" -Force
}
function Update-DotNetSdkVersion {
$globalJsonPath = "$PSScriptRoot/global.json"
$globalJson = get-content $globalJsonPath | convertfrom-json
$oldVersion = $globalJson.sdk.version
$versionParts = $oldVersion -split '\.'
$channel = $versionParts[0], $versionParts[1] -join '.'
Write-Verbose "channel: $channel" -Verbose
$azure_feed = 'https://dotnetcli.azureedge.net/dotnet'
$version_file_url = "$azure_feed/Sdk/$channel/latest.version"
$version = Invoke-RestMethod $version_file_url
Write-Verbose "updating from: $oldVersion to: $version" -Verbose
$globalJson.sdk.version = $version
$globalJson | convertto-json | out-file $globalJsonPath
$dotnetRuntimeMetaPath = "$psscriptroot\DotnetRuntimeMetadata.json"
$dotnetRuntimeMeta = get-content $dotnetRuntimeMetaPath | convertfrom-json
$dotnetRuntimeMeta.sdk.sdkImageVersion = $version
$dotnetRuntimeMeta | ConvertTo-Json | Out-File $dotnetRuntimeMetaPath
}