From ad5f9e6cea0aafdb22441f68c186724b11324696 Mon Sep 17 00:00:00 2001 From: jibedoubleve Date: Fri, 11 Sep 2020 14:53:28 +0200 Subject: [PATCH] (maint) Fix build script --- chocolatey/build-package.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chocolatey/build-package.ps1 b/chocolatey/build-package.ps1 index fc1b526..ac10a2e 100644 --- a/chocolatey/build-package.ps1 +++ b/chocolatey/build-package.ps1 @@ -10,6 +10,8 @@ $publishDir = "..\Publish" $installer = "$publishDir\logreader.*.setup.exe" $outputDir = "$publishDir\logreader" +$pattern = "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*((\.|)\d{0,2})\.setup.exe" + <################################################################################ # FUNCTIONS ################################################################################> @@ -17,7 +19,7 @@ function GetSemVersion() { if ($items = Get-ChildItem $installer) { - $items[0].Name -match "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*\.(\d{1,2})\.setup.exe" > $null + $items[0].Name -match $pattern > $null return "$($Matches[1])$(GetMode).$($Matches[2])" } else { @@ -26,8 +28,8 @@ function GetSemVersion() { } function GetVersion() { if ($items = Get-ChildItem $installer) { - $items[0].Name -match "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*\.(\d{1,2})\.setup.exe" > $null - return "$($Matches[1]).$($Matches[2])" + $items[0].Name -match $pattern > $null + return "$($Matches[1])$($Matches[2])" } else { throw "Cannot extract version: Cannot find file '$installer'. [PWD] $pwd" @@ -64,7 +66,7 @@ $instScr = "$outputDir\tools\chocolateyinstall.ps1" $version = GetVersion $semVersion = GetSemVersion -write-host $version -ForegroundColor Cyan +write-host "Version: $version" -ForegroundColor Cyan $(Get-Content $nuspec) -replace ".*", "$version" | Set-Content -Path $nuspec $(Get-Content $instScr) -replace "toolsDir 'logreader.(.*).setup.exe'", "toolsDir 'logreader.$semVersion.setup.exe'" | Set-Content -Path $instScr