|
30 | 30 |
|
31 | 31 | # Folder where the built modules are outputted. 'outputs/modules/MyModule' |
32 | 32 | [Parameter(Mandatory)] |
33 | | - [System.IO.DirectoryInfo] $ModuleOutputFolder |
| 33 | + [System.IO.DirectoryInfo] $ModuleOutputFolder, |
| 34 | + |
| 35 | + # The Major.Minor.Patch version to stamp into the manifest. Defaults to '999.0.0' for local builds. |
| 36 | + [Parameter()] |
| 37 | + [string] $ModuleVersion = '999.0.0', |
| 38 | + |
| 39 | + # Optional prerelease tag (without the leading hyphen). |
| 40 | + [Parameter()] |
| 41 | + [string] $Prerelease = '' |
34 | 42 | ) |
35 | 43 |
|
36 | 44 | Set-GitHubLogGroup 'Build manifest file' { |
|
55 | 63 | $manifest.RootModule = $rootModule |
56 | 64 | Write-Host "[RootModule] - [$($manifest.RootModule)]" |
57 | 65 |
|
58 | | - $manifest.ModuleVersion = '999.0.0' |
| 66 | + if ([string]::IsNullOrWhiteSpace($ModuleVersion)) { |
| 67 | + $ModuleVersion = '999.0.0' |
| 68 | + } |
| 69 | + $manifest.ModuleVersion = $ModuleVersion |
59 | 70 | Write-Host "[ModuleVersion] - [$($manifest.ModuleVersion)]" |
60 | 71 |
|
| 72 | + if (-not [string]::IsNullOrWhiteSpace($Prerelease)) { |
| 73 | + $manifest.Prerelease = $Prerelease |
| 74 | + Write-Host "[Prerelease] - [$Prerelease]" |
| 75 | + } |
| 76 | + |
61 | 77 | $manifest.Author = $manifest.Keys -contains 'Author' ? (-not [string]::IsNullOrEmpty($manifest.Author)) ? $manifest.Author : $env:GITHUB_REPOSITORY_OWNER : $env:GITHUB_REPOSITORY_OWNER |
62 | 78 | Write-Host "[Author] - [$($manifest.Author)]" |
63 | 79 |
|
|
418 | 434 | } |
419 | 435 |
|
420 | 436 | Write-Host '[PreRelease]' |
421 | | - # $manifest.PreRelease = "" |
422 | | - # Is managed by the publish action |
| 437 | + # PreRelease is stamped earlier in this function when a value is provided via the Prerelease parameter. |
| 438 | + # No mutation happens after the manifest is built; the resulting artifact is the one that ships. |
423 | 439 |
|
424 | 440 | Write-Host '[RequireLicenseAcceptance]' |
425 | 441 | $manifest.RequireLicenseAcceptance = $PSData.Keys -contains 'RequireLicenseAcceptance' ? $null -ne $PSData.RequireLicenseAcceptance ? $PSData.RequireLicenseAcceptance : $false : $false |
|
0 commit comments