From ffeb2c78a1558f26a9c299ffc2815f57f0e536f9 Mon Sep 17 00:00:00 2001 From: Bernie White Date: Sat, 11 May 2019 19:25:19 +1000 Subject: [PATCH] Fix CI module versioning (#8) - Fix CI module versioning - Install PSRule module before versioning --- pipeline.build.ps1 | 11 ++++++++--- scripts/pipeline-build.ps1 | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pipeline.build.ps1 b/pipeline.build.ps1 index 30af564..0ca4562 100644 --- a/pipeline.build.ps1 +++ b/pipeline.build.ps1 @@ -21,6 +21,10 @@ param ( [String]$ArtifactPath = (Join-Path -Path $PWD -ChildPath out/modules) ) +if ($Env:SYSTEM_DEBUG -eq 'true') { + $VerbosePreference = 'Continue'; +} + if ($Env:Coverage -eq 'true') { $CodeCoverage = $True; } @@ -55,7 +59,7 @@ function CopyModuleFiles { } } -task VersionModule { +task VersionModule PSRule, { if (![String]::IsNullOrEmpty($ReleaseVersion)) { Write-Verbose -Message "[VersionModule] -- ReleaseVersion: $ReleaseVersion"; $ModuleVersion = $ReleaseVersion; @@ -68,7 +72,6 @@ task VersionModule { $revision = [String]::Empty; Write-Verbose -Message "[VersionModule] -- Using Version: $version"; - Write-Verbose -Message "[VersionModule] -- Using Revision: $revision"; if ($version -like '*-*') { [String[]]$versionParts = $version.Split('-', [System.StringSplitOptions]::RemoveEmptyEntries); @@ -77,6 +80,8 @@ task VersionModule { if ($versionParts.Length -eq 2) { $revision = $versionParts[1]; } + + Write-Verbose -Message "[VersionModule] -- Using Revision: $revision"; } # Update module version @@ -179,7 +184,7 @@ task Clean { Remove-Item -Path out,reports -Recurse -Force -ErrorAction SilentlyContinue; } -task Build Clean, BuildModule +task Build Clean, BuildModule, VersionModule task Test Build, TestRules diff --git a/scripts/pipeline-build.ps1 b/scripts/pipeline-build.ps1 index 265216c..cef6b06 100644 --- a/scripts/pipeline-build.ps1 +++ b/scripts/pipeline-build.ps1 @@ -30,10 +30,19 @@ param ( [String]$ArtifactPath ) +if ($Env:SYSTEM_DEBUG -eq 'true') { + $VerbosePreference = 'Continue'; +} + if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) { Install-PackageProvider -Name NuGet -Force -Scope CurrentUser; } +if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.1.2 -ErrorAction Ignore)) { + Install-Module PowerShellGet -MinimumVersion 2.1.2 -Scope CurrentUser -Force -AllowClobber; + Import-Module PowerShellGet -MinimumVersion 2.1.2 -Force; +} + if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) { Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force; }