diff --git a/scripts/package-nuget.ps1 b/scripts/package-nuget.ps1 index 5f1d70fbe..1e2a714e7 100644 --- a/scripts/package-nuget.ps1 +++ b/scripts/package-nuget.ps1 @@ -17,7 +17,10 @@ param ( [Parameter(Mandatory = $false)] [ValidateSet("schannel", "openssl")] - [string]$Tls = "openssl" + [string]$Tls = "openssl", + + [Parameter(Mandatory = $false)] + [switch]$ReleaseBuild = $false ) Set-StrictMode -Version 'Latest' @@ -124,4 +127,19 @@ $DistDir = Join-Path $BaseArtifactsDir "dist" $CurrentCommitHash = Get-GitHash -RepoDir $RootDir $RepoRemote = Get-GitRemote -RepoDir $RootDir -nuget.exe pack (Join-Path $PackagingDir "Microsoft.Native.Quic.MsQuic.$Tls.nuspec") -OutputDirectory $DistDir -p CommitHash=$CurrentCommitHash -p RepoRemote=$RepoRemote +$Version = "1.8.0" + +$BuildId = $env:BUILD_BUILDID +if ($null -ne $BuildId) { + if ($ReleaseBuild) { + $Version += "+$BuildId" + } else { + $Version += "-ci.$BuildId" + } +} else { + $Version += "-local" +} + +Write-Host $Version + +nuget.exe pack (Join-Path $PackagingDir "Microsoft.Native.Quic.MsQuic.$Tls.nuspec") -OutputDirectory $DistDir -p CommitHash=$CurrentCommitHash -p RepoRemote=$RepoRemote -Version $Version diff --git a/scripts/update-version.ps1 b/scripts/update-version.ps1 index e56a16082..c2aecc03b 100644 --- a/scripts/update-version.ps1 +++ b/scripts/update-version.ps1 @@ -27,8 +27,7 @@ $RootDir = Split-Path $PSScriptRoot -Parent $MsQuicVerFilePath = Join-Path $RootDir "src" "inc" "msquic.ver" $CreatePackageFilePath = Join-Path $RootDir ".azure" "templates" "create-package.yml" $QnsFilePath = Join-Path $RootDir ".azure" "azure-pipelines.qns.yml" -$NuspecOpenSSLFilePath = Join-Path $RootDir "src" "nuget" "msquic-openssl.nuspec" -$NuspecSchannelFilePath = Join-Path $RootDir "src" "nuget" "msquic-schannel.nuspec" +$NugetPackageFile = Join-Path $RootDir "scripts" "package-nuget.ps1" # Get the current version number from the msquic.ver file. $VerMajor = (Select-String -Path $MsQuicVerFilePath "#define VER_MAJOR (.*)" -AllMatches).Matches[0].Groups[1].Value @@ -62,9 +61,6 @@ Write-Host " New version: $NewVerMajor.$NewVerMinor.$NewVerPatch" (Get-Content $QnsFilePath) ` -replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |` Out-File $QnsFilePath -(Get-Content $NuspecOpenSSLFilePath) ` +(Get-Content $NugetPackageFile) ` -replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |` - Out-File $NuspecOpenSSLFilePath -(Get-Content $NuspecSchannelFilePath) ` - -replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |` - Out-File $NuspecSchannelFilePath + Out-File $NugetPackageFile diff --git a/src/nuget/Microsoft.Native.Quic.MsQuic.OpenSSL.nuspec b/src/nuget/Microsoft.Native.Quic.MsQuic.OpenSSL.nuspec index 9858ed72d..c515107d3 100644 --- a/src/nuget/Microsoft.Native.Quic.MsQuic.OpenSSL.nuspec +++ b/src/nuget/Microsoft.Native.Quic.MsQuic.OpenSSL.nuspec @@ -2,7 +2,7 @@ Microsoft.Native.Quic.MsQuic.OpenSSL - 1.8.0 + 0.0.0 MsQuic (OpenSSL) Microsoft MIT AND Apache-2.0 diff --git a/src/nuget/Microsoft.Native.Quic.MsQuic.Schannel.nuspec b/src/nuget/Microsoft.Native.Quic.MsQuic.Schannel.nuspec index 48f4f4f2c..ddd115ac5 100644 --- a/src/nuget/Microsoft.Native.Quic.MsQuic.Schannel.nuspec +++ b/src/nuget/Microsoft.Native.Quic.MsQuic.Schannel.nuspec @@ -2,7 +2,7 @@ Microsoft.Native.Quic.MsQuic.Schannel - 1.8.0 + 0.0.0 MsQuic (Schannel) Microsoft MIT