Skip to content

Commit 3b26296

Browse files
Rename inputs: remove Name, add OutputFolder; make Version mandatory
- Remove Name input; module name is always inferred from GITHUB_REPOSITORY_NAME - Add OutputFolder input (default: outputs/module) to configure the build output path - Make Version required in action.yml, mandatory in Build-PSModule and Build-PSModuleManifest helpers - Remove 999.0.0 version fallback; build now fails explicitly when Version is not provided - Update Action-Test.yml: remove Name input, add Version: 1.0.0 to all test jobs
1 parent f897a03 commit 3b26296

5 files changed

Lines changed: 20 additions & 19 deletions

File tree

.github/workflows/Action-Test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Action-Test
3131
uses: ./
3232
with:
33-
Name: PSModuleTest
33+
Version: 1.0.0
3434
ArtifactName: PSModuleTestDefault
3535
WorkingDirectory: tests/srcTestRepo
3636

@@ -46,7 +46,7 @@ jobs:
4646
- name: Action-Test
4747
uses: ./
4848
with:
49-
Name: PSModuleTest
49+
Version: 1.0.0
5050
ArtifactName: PSModuleTestMinimal
5151
WorkingDirectory: tests/srcMinimalTestRepo
5252

@@ -62,6 +62,6 @@ jobs:
6262
- name: Action-Test
6363
uses: ./
6464
with:
65-
Name: PSModuleTest
65+
Version: 1.0.0
6666
ArtifactName: PSModuleTestWithManifest
6767
WorkingDirectory: tests/srcWithManifestTestRepo

action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ description: Build a PowerShell module to the PowerShell Gallery.
33
author: PSModule
44

55
inputs:
6-
Name:
7-
description: Name of the module to process.
6+
OutputFolder:
7+
description: Path to the folder where the built module is outputted.
88
required: false
9+
default: 'outputs/module'
910
Version:
10-
description: Module version to stamp into the manifest. When empty, the manifest version defaults to `999.0.0`.
11-
required: false
11+
description: Module version to stamp into the manifest.
12+
required: true
1213
Prerelease:
1314
description: Prerelease tag to stamp into the manifest's `PrivateData.PSData.Prerelease`. When empty, no prerelease tag is written.
1415
required: false
@@ -32,7 +33,7 @@ runs:
3233
id: build
3334
working-directory: ${{ inputs.WorkingDirectory }}
3435
env:
35-
PSMODULE_BUILD_PSMODULE_INPUT_Name: ${{ inputs.Name }}
36+
PSMODULE_BUILD_PSMODULE_INPUT_OutputFolder: ${{ inputs.OutputFolder }}
3637
PSMODULE_BUILD_PSMODULE_INPUT_Version: ${{ inputs.Version }}
3738
PSMODULE_BUILD_PSMODULE_INPUT_Prerelease: ${{ inputs.Prerelease }}
3839
run: |

src/helpers/Build-PSModule.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
[Parameter(Mandatory)]
3030
[string] $ModuleOutputFolderPath,
3131

32-
# Module version to stamp into the manifest. When empty, defaults to '999.0.0'.
33-
[Parameter()]
32+
# Module version to stamp into the manifest.
33+
[Parameter(Mandatory)]
3434
[string] $ModuleVersion,
3535

3636
# Prerelease tag to stamp into the manifest. When empty, no prerelease tag is written.

src/helpers/Build/Build-PSModuleManifest.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
[Parameter(Mandatory)]
3333
[System.IO.DirectoryInfo] $ModuleOutputFolder,
3434

35-
# Module version to stamp into the manifest. When empty, defaults to '999.0.0'.
36-
[Parameter()]
35+
# Module version to stamp into the manifest.
36+
[Parameter(Mandatory)]
3737
[string] $ModuleVersion,
3838

3939
# Prerelease tag to stamp into the manifest's `PrivateData.PSData.Prerelease`.
@@ -63,7 +63,7 @@
6363
$manifest.RootModule = $rootModule
6464
Write-Host "[RootModule] - [$($manifest.RootModule)]"
6565

66-
$manifest.ModuleVersion = if ([string]::IsNullOrWhiteSpace($ModuleVersion)) { '999.0.0' } else { $ModuleVersion }
66+
$manifest.ModuleVersion = $ModuleVersion
6767
Write-Host "[ModuleVersion] - [$($manifest.ModuleVersion)]"
6868

6969
$manifest.Author = $manifest.Keys -contains 'Author' ? (-not [string]::IsNullOrEmpty($manifest.Author)) ? $manifest.Author : $env:GITHUB_REPOSITORY_OWNER : $env:GITHUB_REPOSITORY_OWNER

src/main.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@ Set-GitHubLogGroup "Loading helper scripts from [$path]" {
1616
$env:GITHUB_REPOSITORY_NAME = $env:GITHUB_REPOSITORY -replace '.+/'
1717

1818
Set-GitHubLogGroup 'Loading inputs' {
19-
$moduleName = if ([string]::IsNullOrEmpty($env:PSMODULE_BUILD_PSMODULE_INPUT_Name)) {
20-
$env:GITHUB_REPOSITORY_NAME
21-
} else {
22-
$env:PSMODULE_BUILD_PSMODULE_INPUT_Name
23-
}
19+
$moduleName = $env:GITHUB_REPOSITORY_NAME
2420
$moduleVersion = $env:PSMODULE_BUILD_PSMODULE_INPUT_Version
2521
$modulePrerelease = $env:PSMODULE_BUILD_PSMODULE_INPUT_Prerelease
2622
$sourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
27-
$moduleOutputFolderPath = Join-Path $pwd -ChildPath 'outputs/module'
23+
$moduleOutputFolderPath = Join-Path $pwd -ChildPath $env:PSMODULE_BUILD_PSMODULE_INPUT_OutputFolder
2824
[pscustomobject]@{
2925
moduleName = $moduleName
3026
moduleVersion = $moduleVersion
@@ -34,6 +30,10 @@ Set-GitHubLogGroup 'Loading inputs' {
3430
} | Format-List | Out-String
3531
}
3632

33+
if ([string]::IsNullOrWhiteSpace($moduleVersion)) {
34+
throw 'Version is required. Please provide a module version.'
35+
}
36+
3737
Set-GitHubLogGroup 'Build local scripts' {
3838
Write-Host 'Execution order:'
3939
$scripts = Get-ChildItem -Filter '*build.ps1' -Recurse | Sort-Object -Property Name | Resolve-Path -Relative

0 commit comments

Comments
 (0)