Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
Write-Verbose "OLD_VERSION=$currentVersion" -Verbose
"OLD_VERSION=$currentVersion" | Out-File $env:GITHUB_ENV -Append

./tools/UpdateDotnetRuntime.ps1 -UpdateMSIPackaging
./tools/UpdateDotnetRuntime.ps1 -UpdateMSIPackaging -UseInternalFeed
$newVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
Write-Verbose "NEW_VERSION=$newVersion" -Verbose
"NEW_VERSION=$newVersion" | Out-File $env:GITHUB_ENV -Append
Expand All @@ -48,8 +48,9 @@ jobs:
if: failure()
with:
webhook_url: ${{ secrets.PS_BUILD_TEAMS_CHANNEL }}
overwrite: "{title: `Failure in updating .NET build. Look at ${workflow_link}`}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v3
id: cpr
if: env.CREATE_PR == 'true'
with:
Expand Down
27 changes: 20 additions & 7 deletions tools/UpdateDotnetRuntime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,23 @@ function Get-DotnetUpdate {

try {

$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$quality/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $quality
try {
$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$quality/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $quality
} catch {
if ($_.exception.Response.StatusCode -eq 'NotFound') {
Write-Verbose "Build not found for Channel: $Channel and Quality: $Quality" -Verbose
} else {
throw $_
}
}

if (-not $latestSDKVersionString.StartsWith($sdkImageVersion))
{
if (-not $latestSDKVersionString -or -not $latestSDKVersionString.StartsWith($sdkImageVersion)) {
# we did not get a version number so fall back to daily
$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$qualityFallback/sdk-productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $qualityFallback

if (-not $latestSDKVersionString.StartsWith($sdkImageVersion))
{
if (-not $latestSDKVersionString.StartsWith($sdkImageVersion)) {
throw "No build found!"
}
}
Expand Down Expand Up @@ -272,8 +278,15 @@ if ($dotnetUpdate.ShouldUpdate) {
if ($feedname -eq 'dotnet-internal') {
# This NuGet feed is for internal to Microsoft use only.
$dotnetInternalFeed = $dotnetMetadataJson.internalfeed.url
$updatedNugetFile = $nugetFileContent -replace "</packageSources>", " <add key=`"dotnet-internal`" value=`"$dotnetInternalFeed`" />`r`n </packageSources>"

$updatedNugetFile = if ($nugetFileContent.Contains('dotnet-internal')) {
$nugetFileContent -replace ".<add key=`"dotnet-internal?.*', ' <add key=`"dotnet-internal`" value=`"$dotnetInternalFeed`" />`r`n </packageSources>"
} else {
$nugetFileContent -replace "</packageSources>", " <add key=`"dotnet-internal`" value=`"$dotnetInternalFeed`" />`r`n </packageSources>"
}

$updatedNugetFile | Out-File "$PSScriptRoot/../nuget.config" -Force

Register-PackageSource -Name 'dotnet-internal' -Location $dotnetInternalFeed -ProviderName NuGet
Write-Verbose -Message "Register new package source 'dotnet-internal'" -verbose
}
Expand Down