Skip to content

Commit dbd2eb0

Browse files
committed
Added parameter support to control Step-Version behavior in psake
1 parent 1bf7931 commit dbd2eb0

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Build/build.ps1

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ Warren F. (RamblingCookieMonster)
66
#>
77

88
[cmdletbinding()]
9-
param ($Task = 'Default')
9+
param (
10+
$Task = 'Default',
11+
12+
[ValidateSet('Build','Minor','Major')]
13+
$StepVersionBy = 'Build'
14+
)
1015

1116
# Grab nuget bits, install modules, set build variables, start build.
1217
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
@@ -26,5 +31,12 @@ ForEach ($Module in $Modules) {
2631
$Path = (Resolve-Path $PSScriptRoot\..).Path
2732
Set-BuildEnvironment -Path $Path
2833

29-
Invoke-psake -buildFile $PSScriptRoot\psake.ps1 -taskList $Task -nologo
30-
exit ([int](-not $psake.build_success))
34+
$invokepsakeSplat = @{
35+
buildFile = "$PSScriptRoot\psake.ps1"
36+
taskList = $Task
37+
properties = @{'StepVersionBy' = $StepVersionBy}
38+
nologo = $true
39+
}
40+
Invoke-psake @invokepsakeSplat
41+
42+
exit ([int](-not $psake.build_success))

Build/psake.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# PSake makes variables declared here available in other scriptblocks
22
Properties {
33
# Find the build folder based on build system
4-
$ProjectRoot = Resolve-Path $ENV:BHProjectPath
5-
if(-not $ProjectRoot)
6-
{
7-
$ProjectRoot = Resolve-Path "$PSScriptRoot\.."
8-
}
4+
$ProjectRoot = Resolve-Path $ENV:BHProjectPath
5+
if(-not $ProjectRoot)
6+
{
7+
$ProjectRoot = Resolve-Path "$PSScriptRoot\.."
8+
}
9+
10+
#
11+
$StepVersionBy = 'Build'
912

1013
$Timestamp = Get-date -uformat "%Y%m%d-%H%M%S"
1114
$PSVersion = $PSVersionTable.PSVersion.Major
@@ -91,7 +94,7 @@ Task Build -Depends Test {
9194
Set-ModuleFunctions -Name $env:BHPSModuleManifest -FunctionsToExport $functions
9295

9396
# Bump the module version
94-
$version = [version] (Step-Version (Get-Metadata -Path $env:BHPSModuleManifest))
97+
$version = [version] (Step-Version -Version (Get-Metadata -Path $env:BHPSModuleManifest) -By $StepVersionBy)
9598
$galleryVersion = Get-NextPSGalleryVersion -Name $env:BHProjectName
9699
if($version -lt $galleryVersion)
97100
{

0 commit comments

Comments
 (0)