From 3a6916320b0ce40bf7e421fa99a1d877f46d8aa5 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 30 Jul 2024 13:17:45 -0700 Subject: [PATCH] Add script to update SDK version during release (#24034) --- build.psm1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build.psm1 b/build.psm1 index 9362965888..93e825f295 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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 +}