File tree Expand file tree Collapse file tree
.github/actions/Publish-PSModule/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function Get-ReleaseTag {
2+ <#
3+ . SYNOPSIS
4+ Builds the git tag used for the GitHub release.
5+
6+ . DESCRIPTION
7+ Composes the release tag from the module version and, when present, the prerelease label.
8+ The version comes from the compiled manifest, which is the artifact that is published, so the
9+ tag always names the exact bytes that were tested and pushed to the PowerShell Gallery.
10+
11+ . OUTPUTS
12+ String with the release tag.
13+
14+ . EXAMPLE
15+ Get-ReleaseTag -ModuleVersion '1.1.10'
16+
17+ Returns '1.1.10'.
18+
19+ . EXAMPLE
20+ Get-ReleaseTag -ModuleVersion '1.1.10' -Prerelease 'mybranch001'
21+
22+ Returns '1.1.10-mybranch001'.
23+ #>
24+ [CmdletBinding ()]
25+ [OutputType ([string ])]
26+ param (
27+ # The module version from the compiled manifest, in Major.Minor.Patch format.
28+ [Parameter (Mandatory )]
29+ [ValidateNotNullOrEmpty ()]
30+ [string ] $ModuleVersion ,
31+
32+ # The prerelease label from the compiled manifest. Empty for a stable release.
33+ [Parameter ()]
34+ [AllowEmptyString ()]
35+ [AllowNull ()]
36+ [string ] $Prerelease
37+ )
38+
39+ if ([string ]::IsNullOrWhiteSpace($Prerelease )) {
40+ return $ModuleVersion
41+ }
42+
43+ " $ModuleVersion -$ ( $Prerelease.Trim ()) "
44+ }
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ param()
2828$PSStyle.OutputRendering = ' Ansi'
2929
3030Import-Module - Name ' PSModule' - Force
31+ Import-Module - Name " $PSScriptRoot /Publish-PSModule.Helpers.psm1" - Force
3132
3233# region Load inputs
3334LogGroup ' Load inputs' {
@@ -129,7 +130,7 @@ LogGroup 'Resolve version from manifest' {
129130 $createPrerelease = $true
130131 }
131132
132- $releaseTag = if ( $createPrerelease ) { " $moduleVersion - $prerelease " } else { $moduleVersion }
133+ $releaseTag = Get-ReleaseTag - ModuleVersion $moduleVersion - Prerelease $prerelease
133134
134135 [PSCustomObject ]@ {
135136 ModuleVersion = $moduleVersion
You can’t perform that action at this time.
0 commit comments