Repository navigation
ci(release): publish NuGet via ESRP and authenticate Hidi Docker restores #3107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Vincent Biret (baywet)
merged 4 commits into
main
from
copilot/replicate-changes-from-pr-8365
Oct 9, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5f0eb3d
ci(release): publish OpenAPI packages and symbols through ESRP
Copilot c5b68c5
ci(hidi): authenticate Docker restores using a BuildKit secret
Copilot aedec9b
ci(release): share authenticated private-feed version checks
Copilot 8ed2fbc
ci(release): align NuGet publication checks across repositories
baywet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageId, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageDirectory, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$NuGetServiceIndexUrl | ||
| ) | ||
|
|
||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($env:FEED_ACCESS_TOKEN)) { | ||
| throw 'No Azure Artifacts access token available for the version check.' | ||
| } | ||
|
|
||
| $packagePattern = '^' + [regex]::Escape($PackageId) + '\.(\d[\w\.\-]*)\.nupkg$' | ||
| $packages = @(Get-ChildItem -Path $PackageDirectory -Filter "$PackageId.*.nupkg" | | ||
| Where-Object { $_.Name -match $packagePattern }) | ||
| if ($packages.Count -ne 1) { | ||
| throw "Expected exactly one $PackageId nupkg to publish; found $($packages.Count)." | ||
| } | ||
| $version = [regex]::Match($packages[0].Name, $packagePattern, 'IgnoreCase').Groups[1].Value | ||
| $id = $PackageId.ToLowerInvariant() | ||
| $credentials = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("AzureDevOps:$($env:FEED_ACCESS_TOKEN)")) | ||
| $headers = @{ | ||
| 'User-Agent' = 'openapinet-azdo-pipeline' | ||
| 'Authorization' = "Basic $credentials" | ||
| } | ||
|
|
||
| $serviceIndex = Invoke-RestMethod -Uri $NuGetServiceIndexUrl -Headers $headers | ||
| $packageBaseAddress = $serviceIndex.resources | | ||
| Where-Object { $_.'@type' -eq 'PackageBaseAddress/3.0.0' } | | ||
| Select-Object -First 1 -ExpandProperty '@id' | ||
| if ([string]::IsNullOrWhiteSpace($packageBaseAddress)) { | ||
| throw 'The private NuGet feed does not advertise a package base address.' | ||
| } | ||
|
|
||
| $uri = "$($packageBaseAddress.TrimEnd('/'))/$id/index.json" | ||
| try { | ||
| $response = Invoke-RestMethod -Uri $uri -Headers $headers | ||
| if ($null -eq $response.versions) { | ||
| throw 'The private NuGet feed returned an invalid package version response.' | ||
| } | ||
| $alreadyPublished = $response.versions -contains $version | ||
| } catch { | ||
| if ([int]$_.Exception.Response.StatusCode -eq 404) { | ||
| $alreadyPublished = $false | ||
| } else { | ||
| throw | ||
| } | ||
| } | ||
|
|
||
| if ($alreadyPublished) { | ||
| Write-Host "NuGet $id $version already present in the private feed; skipping ESRP release (idempotent re-run)." | ||
| } else { | ||
| Write-Host "NuGet $id $version not found in the private feed; will publish via ESRP." | ||
| } | ||
| Write-Host "##vso[task.setvariable variable=nugetAlreadyPublished]$($alreadyPublished.ToString().ToLowerInvariant())" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.