-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ps1
More file actions
45 lines (38 loc) · 1.54 KB
/
Copy pathmain.ps1
File metadata and controls
45 lines (38 loc) · 1.54 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
[CmdletBinding()]
param()
$PSStyle.OutputRendering = 'Ansi'
Import-Module -Name 'PSModule' -Force
Import-Module -Name "$PSScriptRoot/Resolve-PSModuleVersion.Helpers.psm1" -Force
$actionInput = Read-ActionInput
$config = Get-PublishConfiguration -SettingsJson $actionInput.SettingsJson
$pullRequest = Get-GitHubPullRequest
$decision = if ($null -eq $pullRequest) {
# Non-PR event (for example workflow_dispatch or schedule): there are no pull request
# labels to determine a version bump, so keep the current published version and publish
# nothing. For a module that has never been released this floors at 0.0.0.
[PSCustomObject]@{
ShouldPublish = $false
CreateRelease = $false
CreatePrerelease = $false
MajorRelease = $false
MinorRelease = $false
PatchRelease = $false
HasVersionBump = $false
PrereleaseName = ''
}
} else {
Resolve-ReleaseDecision -Configuration $config -PullRequest $pullRequest
}
$releases = @(Get-GitHubRelease)
$ghVersion = Get-LatestGitHubVersion -Releases $releases
$psGalleryVersion = Get-LatestPSGalleryVersion -ModuleName $actionInput.Name
$latestVersion = Get-LatestPublishedVersion -GitHubVersion $ghVersion -PSGalleryVersion $psGalleryVersion
$params = @{
LatestVersion = $latestVersion
Decision = $decision
Configuration = $config
ModuleName = $actionInput.Name
Releases = $releases
}
$newVersion = Get-NextModuleVersion @params
Write-ActionOutput -Decision $decision -NewVersion $newVersion