diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index d1c27c4d..1abe554b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -378,6 +378,13 @@ jobs: $path = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "${{ inputs.ModulesOutputPath }}\$moduleName" $moduleManifestPath = Join-Path -Path $Path -ChildPath "$moduleName.psd1" + # Obay module manifest overrides + $sourcePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "${{ inputs.Path }}" + $sourceModuleManifestPath = Join-Path -Path $sourcePath -ChildPath "manifest.psd1" + if (Test-Path -Path $sourceModuleManifestPath) { + $sourceManifest = Import-PowerShellDataFile -Path $sourceModuleManifestPath + } + $data = [pscustomobject]@{ ModuleName = $moduleName Path = $path @@ -385,7 +392,9 @@ jobs: } Write-Verbose ($data | Format-List | Out-String) -Verbose - Set-ModuleManifest -Path $moduleManifestPath -PowerShellVersion '7.4' + # If the source module manifest has a PowerShellVersion, use that, otherwise use the latest version. + $powerShellVersion = $sourceManifest.PowerShellVersion ?? '7.4' + Set-ModuleManifest -Path $moduleManifestPath -PowerShellVersion $powerShellVersion Add-ModuleManifestData -Path $moduleManifestPath -CompatiblePSEditions 'Core' Add-ModuleManifestData -Path $moduleManifestPath -Tags 'PSEdition_Core' @@ -403,6 +412,10 @@ jobs: } } + LogGroup 'Module Manifest - Source' { + Show-FileContent -Path $moduleManifestPath + } + LogGroup 'Module Manifest' { Show-FileContent -Path $moduleManifestPath } diff --git a/tests/srcWithManifest/manifest.psd1 b/tests/srcWithManifest/manifest.psd1 index 77348f13..73e59522 100644 --- a/tests/srcWithManifest/manifest.psd1 +++ b/tests/srcWithManifest/manifest.psd1 @@ -1,3 +1,4 @@ @{ - Author = 'Author' + Author = 'Author' + PowerShellVersion = '5.1' }