Skip to content

Commit

Permalink
Add proper CI versioning to nuget (#1921)
Browse files Browse the repository at this point in the history
Right now we don't have a way to trigger a release, that is a next step we need to work through
  • Loading branch information
thhous-msft authored Aug 17, 2021
1 parent 0f4f8fe commit 7dd212c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
22 changes: 20 additions & 2 deletions scripts/package-nuget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
10 changes: 3 additions & 7 deletions scripts/update-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/nuget/Microsoft.Native.Quic.MsQuic.OpenSSL.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.Native.Quic.MsQuic.OpenSSL</id>
<version>1.8.0</version>
<version>0.0.0</version>
<title>MsQuic (OpenSSL)</title>
<authors>Microsoft</authors>
<license type="expression">MIT AND Apache-2.0</license>
Expand Down
2 changes: 1 addition & 1 deletion src/nuget/Microsoft.Native.Quic.MsQuic.Schannel.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.Native.Quic.MsQuic.Schannel</id>
<version>1.8.0</version>
<version>0.0.0</version>
<title>MsQuic (Schannel)</title>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
Expand Down

0 comments on commit 7dd212c

Please sign in to comment.