From 968d4e35fc935ee008deea3e7d0e6977a4a605e2 Mon Sep 17 00:00:00 2001 From: Nick Banks Date: Sat, 28 Sep 2024 12:10:26 -0400 Subject: [PATCH] Publish NuGet Packages Automatically (#4576) --- .azure/OneBranch.Official.yml | 6 ++++++ .azure/obtemplates/build-nuget.yml | 10 ++++++++++ docs/Release.md | 7 ++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.azure/OneBranch.Official.yml b/.azure/OneBranch.Official.yml index 520dfcf7f8..10a568d043 100644 --- a/.azure/OneBranch.Official.yml +++ b/.azure/OneBranch.Official.yml @@ -224,6 +224,12 @@ extends: - build_uwp jobs: - template: .azure/obtemplates/build-nuget.yml@self + # Publish official Nuget packages for tags ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}: parameters: release: true + publish: true + # Publish prerelease Nuget packages for main branch builds + ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: + parameters: + publish: true diff --git a/.azure/obtemplates/build-nuget.yml b/.azure/obtemplates/build-nuget.yml index 6e3f6cc031..8b6e1725f4 100644 --- a/.azure/obtemplates/build-nuget.yml +++ b/.azure/obtemplates/build-nuget.yml @@ -2,6 +2,7 @@ parameters: release: false + publish: false jobs: - job: nuget @@ -92,3 +93,12 @@ jobs: signing_profile: 'external_distribution' files_to_sign: '**/*.nupkg' search_root: '$(ob_outputDirectory)' + + ${{ if eq(parameters.publish, true) }}: + - task: NuGetCommand@2 + displayName: 'Publish to Nuget.org' + inputs: + command: push + nuGetFeedType: external + publishFeedCredentials: 'MsQuic Nuget Publish' + packagesToPush: '$(ob_outputDirectory)/**/*.nupkg' diff --git a/docs/Release.md b/docs/Release.md index 6ff333c804..d3ae7e0211 100644 --- a/docs/Release.md +++ b/docs/Release.md @@ -67,11 +67,6 @@ This table describes all officially supported MsQuic releases. - The tag should be the full version number: `vX.Y.Z` - The release title should be `MsQuic vX.Y.Z` - Put relavent information in the notes of the release (see previous releases for examples) -1. Wait for [msquic-Official](https://mscodehub.visualstudio.com/msquic/_build?definitionId=1738&_a=summary) pipeline to run for the newly created tag. -1. Download the signed Windows NuGet packages (under `drop_package_windows_nuget`) and upload them to [NuGet](https://www.nuget.org/packages/manage/upload): - - Microsoft.Native.Quic.MsQuic.OpenSSL.X.Y.Z.BUILD.nupkg - - Microsoft.Native.Quic.MsQuic.Schannel.X.Y.Z.BUILD.nupkg - - Use https://raw.githubusercontent.com/microsoft/msquic/vX.Y.Z/README.md as package description URL. 1. Wait for [msquic-Official-Tests](https://mscodehub.visualstudio.com/msquic/_build?definitionId=1824&_a=summary) pipeline to run for the newly created tag. 1. Download the `distribution` packages from the artifacts and upload them to the GitHub release: - msquic_gamecore_console_x64_Release_schannel.zip @@ -97,6 +92,8 @@ This table describes all officially supported MsQuic releases. - Run `cargo publish` from the `release/X.Y` branch. 1. Update (via PR) `main` branch's `test-down-level.yml` to point the newly uploaded `*_test.zip` release binaries. +> **Note** - NuGet packages are automatically published to nuget.org by the pipeline. + ### Publishing Linux packages to packages.microsoft.com (PMC) The publishing [pipeline](https://mscodehub.visualstudio.com/msquic/_build?definitionId=2068) automatically uploads packages into PMC when a tag is created.