Repository navigation
Add opt-in manual prerelease publish for library NuGet packages - #851
Alexandre Zollinger Chohfi (azchohfi) merged 8 commits into
Conversation
Adds a publishPrereleaseNugets parameter to release.yml that, when ticked on a manual, non-rel/v* run, packs the three source-built library packages (UIAutomation, UIAutomation.Recording, WinUIAnalyzer) at a prerelease version, ESRP-signs them, and pushes only them to nuget.org via NuGet-WinAppCLI. This enables validating those packages before the first official release. The two stages are self-contained in release.yml (signing inline; build.yaml is untouched). They are gated on the parameter (default false), so they are pruned at compile time on the weekly rehearsal and every real rel/v* release. The gate also requires DoEsrp=true, so the path can never publish unsigned packages, and not(rel/v*), so it can never ride a real release. Stable library publishing is unchanged: it still ships through the normal rel/v* Release_NuGet stage. The prereleaseNugetVersion parameter is passed via an environment variable rather than spliced into the inline script (avoiding PowerShell injection from a queue-time value) and is validated against a strict SemVer prerelease pattern, so a stable version - including stable-with-build-metadata like 0.7.0+build-1 - cannot be published through this path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The production publishing path requires an Azure DevOps template preview before approval.
Pull request overview
Adds an opt-in Azure DevOps workflow for signing and publishing prerelease library NuGet packages without affecting stable releases.
Changes:
- Adds guarded prerelease build and publish stages.
- Validates prerelease versions and signs binaries/packages.
- Documents operation and safety constraints.
File summaries
| File | Description |
|---|---|
.pipelines/release.yml |
Adds parameters and prerelease publishing stages. |
.pipelines/README.md |
Documents the manual publishing workflow. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Build Metrics ReportValidation passed. All required build and validation jobs succeeded. Binary Sizes
.NET Test Results (TRX reports)Other suites are reflected in the overall validation status above. ✅ 7598 passed, 37 skipped out of 7635 tests in 1241.2s (+30.7s vs. baseline) Test Coverage✅ 85.5% line coverage, 79.8% branch coverage · ✅ no change vs. baseline CLI Startup Time51ms median (x64, Try This BuildInstalls the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing. & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 851Switching between builds often?Put the tool on your PATH once: & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPathThen this build is just: winapp-pr 851Run Updated 2026-09-21 19:07:56 UTC · commit |
|
One thing worth flagging before this ships: the prerelease publish path bypasses the tested
I get that decoupling is intentional to avoid waiting on the full ~60-min NativeAOT/MSIX build. If that tradeoff is deliberate, no change needed — just want to make sure it's a conscious choice. If not, the smallest fix is to add |
Prerelease_Nugets_Build was decoupled from the stable Build stage (dependsOn: []) to avoid the ~60-min NativeAOT/MSIX build, but that also skipped the tests that run inside Build - so a manual prerelease queue could sign and immutably publish the three library packages even if their tests failed on that commit. Run the targeted suites for exactly those packages (WinApp.UIAutomation.Tests via Microsoft.Testing.Platform, and the WinUI analyzer xUnit tests) inside Prerelease_Nugets_Build before packing, mirroring build-cli.ps1's runners. A failing suite fails the stage, so the publish stage that depends on it never runs. This keeps the path decoupled and fast while validating what actually ships. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Good catch Alexandre Zollinger Chohfi (@azchohfi) — this was a gap, not a conscious tradeoff, so I fixed it in 4621476. You're right that decoupling from |
test.Tests.ps1 asserted `Should -Not -Match 'release-'` against the entire CLI output to confirm the release publish profile was not selected. That also scans the CLI banner, which prints the version - and on a branch build the version embeds the branch name (e.g. 0.6.3-<branch>-prerelease-pipeline.1), so a branch containing "release-" false-fails the test. Match the resolved `PublishProfile=release-` token specifically, mirroring the positive assertion on the line above, so it still catches a real release-profile regression without false-matching the version banner. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolves two conflicts: - .pipelines/release.yml: main removed the -ServiceConnections argument from the check-release-credentials step and added two federated-token verification tasks (AzureCLI@2 / AzurePowerShell@5) to the verify_credentials job. Kept main's version of that job and re-appended the prerelease library-package stages after the Verify_Release_Credentials stage. - samples/winui-app/test.Tests.ps1: main independently made the same fix (scope the release-profile assertion to the PublishProfile token). Took main's version; the branch's own equivalent fix is now redundant.
What
Adds an opt-in, manual way to publish prerelease versions of the three source-built library NuGet packages to nuget.org, so they can be validated before the first official release:
Microsoft.Windows.SDK.BuildTools.WinApp.UIAutomationMicrosoft.Windows.SDK.BuildTools.WinApp.UIAutomation.RecordingMicrosoft.Windows.SDK.BuildTools.WinUIAnalyzerHow
Queue WinDevCLI - Release manually with the new
publishPrereleaseNugetsparameter ticked (optionally setprereleaseNugetVersion; blank auto-computesversion.json+-prerelease.<build>). This adds two stages —Prerelease_Nugets_BuildandPrerelease_Nugets_Publish— that pack only those three packages (package-nuget.ps1 -SkipCliPackage, so the CLI tools package is never built), ESRP-sign them, and push only them via theNuGet-WinAppCLIservice connection.The two stages are self-contained in
release.ymlwith inline ESRP signing;build.yamlis untouched.Why a parameter on the existing pipeline (not a new pipeline or branch)
NuGet-WinAppCLI+ the signing connection.rel/v*Release_NuGetstage.Safety model
The stages are gated at compile time so they can't misfire:
eq(parameters.publishPrereleaseNugets, true)— defaults false, so the stages are pruned from the graph on every scheduled rehearsal and every realrel/v*release. They exist only when a human explicitly ticks the box.eq(parameters.DoEsrp, true)— the path is pruned entirely when signing is off, so it can never publish unsigned packages.not(startsWith(Build.SourceBranch, 'refs/heads/rel/v'))— belt-and-suspenders: even a manual queue on a release branch publishes nothing, so it can never ride a real release.The
prereleaseNugetVersionvalue is passed via an environment variable (not spliced into the inline script, avoiding PowerShell injection from a queue-time value) and validated against a strict SemVer-prerelease pattern, so a stable version — including stable-with-build-metadata like0.7.0+build-1— cannot be published through this path.Prerelease_Nugets_Buildalso runs the targeted test suites for exactly these packages (WinApp.UIAutomation.Testsand the WinUI analyzer tests) before packing, so a test-failing commit can't be signed or published — while staying decoupled from the full ~60-min stableBuild.Incidental fix: over-broad assertion in the winui-app sample test
samples/winui-app/test.Tests.ps1:154assertedShould -Not -Match 'release-'on the whole CLI output to check that the release publish profile wasn't selected. That scans the banner too, and on a branch build the banner prints a version that embeds the branch name (here0.6.3-...-prerelease-pipeline.1), which containsrelease-and false-fails the test. Tightened it to match the resolvedPublishProfile=release-token specifically (mirroring the positive assertion on the line above), so it still catches a real release-profile regression without false-matching the version string. This is a latent bug that would fail any branch whose name containsrelease-; it is unrelated to the pipeline change but was surfacing as red CI on this branch.Review notes
Went through the repo's
pr-reviewskill. It surfaced two HIGH findings (unsigned-publish reachable withDoEsrp=false; version-parameter injection + weak prerelease guard); both are fixed here and confirmed clean on re-review by an independent different-model cross-check. A reviewer also flagged that the decoupled build skipped tests — addressed with the targeted test gate above.Not yet validated: an actual ADO template compile / preview and a real nuget.org push —
api.nuget.orgis unreachable from the corp dev environment. A dry compile in Azure DevOps on this branch is worth doing before first real use.Files
.pipelines/release.yml— two parameters + the two self-contained prerelease stages (with the library test gate).pipelines/README.md— "Publishing a prerelease of the library packages" sectionsamples/winui-app/test.Tests.ps1— tighten the release-profile assertion (incidental CI fix)