-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvokeNovaVersionUpdateWorkflow.ps1
More file actions
45 lines (38 loc) · 1.33 KB
/
Copy pathInvokeNovaVersionUpdateWorkflow.ps1
File metadata and controls
45 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function Invoke-NovaVersionUpdateWorkflow {
[CmdletBinding()]
param(
[Parameter(Mandatory)][pscustomobject]$WorkflowContext,
[switch]$ShouldRun,
[switch]$WhatIfEnabled
)
$versionWriteResult = $null
if ($ShouldRun) {
$versionWriteResult = Set-NovaModuleVersion -ProjectInfo $WorkflowContext.ProjectInfo -Label $WorkflowContext.Label -PreviewRelease:$WorkflowContext.PreviewRelease -Confirm:$false
}
if (-not (Test-NovaVersionUpdateResultRequired -ShouldRun:$ShouldRun -WhatIfEnabled:$WhatIfEnabled)) {
return
}
return Get-NovaVersionUpdateResult -WorkflowContext $WorkflowContext -Applied:($null -ne $versionWriteResult -and $versionWriteResult.Applied)
}
function Test-NovaVersionUpdateResultRequired {
[CmdletBinding()]
param(
[switch]$ShouldRun,
[switch]$WhatIfEnabled
)
return $ShouldRun -or $WhatIfEnabled
}
function Get-NovaVersionUpdateResult {
[CmdletBinding()]
param(
[Parameter(Mandatory)][pscustomobject]$WorkflowContext,
[switch]$Applied
)
return [pscustomobject]@{
PreviousVersion = $WorkflowContext.PreviousVersion
NewVersion = $WorkflowContext.NewVersion
Label = $WorkflowContext.Label
CommitCount = $WorkflowContext.CommitCount
Applied = [bool]$Applied
}
}