File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 - name : Action-Test
3131 uses : ./
3232 with :
33- Name : PSModuleTest
33+ Version : 1.0.0
3434 ArtifactName : PSModuleTestDefault
3535 WorkingDirectory : tests/srcTestRepo
3636
4646 - name : Action-Test
4747 uses : ./
4848 with :
49- Name : PSModuleTest
49+ Version : 1.0.0
5050 ArtifactName : PSModuleTestMinimal
5151 WorkingDirectory : tests/srcMinimalTestRepo
5252
6262 - name : Action-Test
6363 uses : ./
6464 with :
65- Name : PSModuleTest
65+ Version : 1.0.0
6666 ArtifactName : PSModuleTestWithManifest
6767 WorkingDirectory : tests/srcWithManifestTestRepo
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ description: Build a PowerShell module to the PowerShell Gallery.
33author : PSModule
44
55inputs :
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
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 : |
Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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`.
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
Original file line number Diff line number Diff line change @@ -16,15 +16,11 @@ Set-GitHubLogGroup "Loading helper scripts from [$path]" {
1616$env: GITHUB_REPOSITORY_NAME = $env: GITHUB_REPOSITORY -replace ' .+/'
1717
1818Set-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+
3737Set-GitHubLogGroup ' Build local scripts' {
3838 Write-Host ' Execution order:'
3939 $scripts = Get-ChildItem - Filter ' *build.ps1' - Recurse | Sort-Object - Property Name | Resolve-Path - Relative
You can’t perform that action at this time.
0 commit comments