Add proper CI versioning to nuget (#1921)

Right now we don't have a way to trigger a release, that is a next step we need to work through
This commit is contained in:
Thad House 2021-08-17 09:24:05 -07:00 коммит произвёл GitHub
Родитель 0f4f8fe8f3
Коммит 7dd212c8ae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 25 добавлений и 11 удалений

Просмотреть файл

@ -17,7 +17,10 @@ param (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[ValidateSet("schannel", "openssl")] [ValidateSet("schannel", "openssl")]
[string]$Tls = "openssl" [string]$Tls = "openssl",
[Parameter(Mandatory = $false)]
[switch]$ReleaseBuild = $false
) )
Set-StrictMode -Version 'Latest' Set-StrictMode -Version 'Latest'
@ -124,4 +127,19 @@ $DistDir = Join-Path $BaseArtifactsDir "dist"
$CurrentCommitHash = Get-GitHash -RepoDir $RootDir $CurrentCommitHash = Get-GitHash -RepoDir $RootDir
$RepoRemote = Get-GitRemote -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

Просмотреть файл

@ -27,8 +27,7 @@ $RootDir = Split-Path $PSScriptRoot -Parent
$MsQuicVerFilePath = Join-Path $RootDir "src" "inc" "msquic.ver" $MsQuicVerFilePath = Join-Path $RootDir "src" "inc" "msquic.ver"
$CreatePackageFilePath = Join-Path $RootDir ".azure" "templates" "create-package.yml" $CreatePackageFilePath = Join-Path $RootDir ".azure" "templates" "create-package.yml"
$QnsFilePath = Join-Path $RootDir ".azure" "azure-pipelines.qns.yml" $QnsFilePath = Join-Path $RootDir ".azure" "azure-pipelines.qns.yml"
$NuspecOpenSSLFilePath = Join-Path $RootDir "src" "nuget" "msquic-openssl.nuspec" $NugetPackageFile = Join-Path $RootDir "scripts" "package-nuget.ps1"
$NuspecSchannelFilePath = Join-Path $RootDir "src" "nuget" "msquic-schannel.nuspec"
# Get the current version number from the msquic.ver file. # Get the current version number from the msquic.ver file.
$VerMajor = (Select-String -Path $MsQuicVerFilePath "#define VER_MAJOR (.*)" -AllMatches).Matches[0].Groups[1].Value $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) ` (Get-Content $QnsFilePath) `
-replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |` -replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |`
Out-File $QnsFilePath Out-File $QnsFilePath
(Get-Content $NuspecOpenSSLFilePath) ` (Get-Content $NugetPackageFile) `
-replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |` -replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |`
Out-File $NuspecOpenSSLFilePath Out-File $NugetPackageFile
(Get-Content $NuspecSchannelFilePath) `
-replace "$VerMajor.$VerMinor.$VerPatch", "$NewVerMajor.$NewVerMinor.$NewVerPatch" |`
Out-File $NuspecSchannelFilePath

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>Microsoft.Native.Quic.MsQuic.OpenSSL</id> <id>Microsoft.Native.Quic.MsQuic.OpenSSL</id>
<version>1.8.0</version> <version>0.0.0</version>
<title>MsQuic (OpenSSL)</title> <title>MsQuic (OpenSSL)</title>
<authors>Microsoft</authors> <authors>Microsoft</authors>
<license type="expression">MIT AND Apache-2.0</license> <license type="expression">MIT AND Apache-2.0</license>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>Microsoft.Native.Quic.MsQuic.Schannel</id> <id>Microsoft.Native.Quic.MsQuic.Schannel</id>
<version>1.8.0</version> <version>0.0.0</version>
<title>MsQuic (Schannel)</title> <title>MsQuic (Schannel)</title>
<authors>Microsoft</authors> <authors>Microsoft</authors>
<license type="expression">MIT</license> <license type="expression">MIT</license>