diff --git a/scripts/helpers/Build-PSModuleDocumentation.ps1 b/scripts/helpers/Build-PSModuleDocumentation.ps1 index 09ef6cd..b5488f4 100644 --- a/scripts/helpers/Build-PSModuleDocumentation.ps1 +++ b/scripts/helpers/Build-PSModuleDocumentation.ps1 @@ -1,5 +1,5 @@ -#Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } +#Requires -Modules GitHub +#Requires -Modules Utilities function Build-PSModuleDocumentation { <# diff --git a/scripts/helpers/Import-PSModule.ps1 b/scripts/helpers/Import-PSModule.ps1 index 2797069..3594bed 100644 --- a/scripts/helpers/Import-PSModule.ps1 +++ b/scripts/helpers/Import-PSModule.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } +#Requires -Modules Utilities function Import-PSModule { <# diff --git a/scripts/helpers/Resolve-PSModuleDependency.ps1 b/scripts/helpers/Resolve-PSModuleDependency.ps1 index 4924d3e..8a6ddca 100644 --- a/scripts/helpers/Resolve-PSModuleDependency.ps1 +++ b/scripts/helpers/Resolve-PSModuleDependency.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Retry'; ModuleVersion = '0.1.3' } +#Requires -Modules Retry function Resolve-PSModuleDependency { <# diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 20ef6a1..80fef4b 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -1,53 +1,40 @@ -#Requires -Modules Utilities - -[CmdletBinding()] -param() - -$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative -LogGroup "Loading helper scripts from [$path]" { - Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object { - Write-Host "$_" - . $_ - } -} - -LogGroup 'Loading inputs' { - $moduleName = ($env:GITHUB_ACTION_INPUT_Name | IsNullOrEmpty) ? $env:GITHUB_REPOSITORY_NAME : $env:GITHUB_ACTION_INPUT_Name - Write-Host "Module name: [$moduleName]" - - $moduleSourceFolderPath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath $env:GITHUB_ACTION_INPUT_Path/$moduleName - if (-not (Test-Path -Path $moduleSourceFolderPath)) { - $moduleSourceFolderPath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath $env:GITHUB_ACTION_INPUT_Path - } - Write-Host "Source module path: [$moduleSourceFolderPath]" - if (-not (Test-Path -Path $moduleSourceFolderPath)) { - throw "Module path [$moduleSourceFolderPath] does not exist." - } - - $modulesOutputFolderPath = Join-Path $env:GITHUB_WORKSPACE $env:GITHUB_ACTION_INPUT_ModulesOutputPath - Write-Host "Modules output path: [$modulesOutputFolderPath]" - $docsOutputFolderPath = Join-Path $env:GITHUB_WORKSPACE $env:GITHUB_ACTION_INPUT_DocsOutputPath - Write-Host "Docs output path: [$docsOutputFolderPath]" -} - -LogGroup 'Build local scripts' { - Write-Host 'Execution order:' - $scripts = Get-ChildItem -Filter '*build.ps1' -Recurse | Sort-Object -Property Name | Resolve-Path -Relative - $scripts | ForEach-Object { - Write-Host " - $_" - } - $scripts | ForEach-Object { - LogGroup "Build local scripts - [$_]" { - . $_ - } - } -} - -$params = @{ - ModuleName = $moduleName - ModuleSourceFolderPath = $moduleSourceFolderPath - ModulesOutputFolderPath = $modulesOutputFolderPath - DocsOutputFolderPath = $docsOutputFolderPath -} - -Build-PSModuleDocumentation @params +#Requires -Modules Utilities + +[CmdletBinding()] +param() + +$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative +LogGroup "Loading helper scripts from [$path]" { + Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object { + Write-Host "$_" + . $_ + } +} + +LogGroup 'Loading inputs' { + $moduleName = ($env:GITHUB_ACTION_INPUT_Name | IsNullOrEmpty) ? $env:GITHUB_REPOSITORY_NAME : $env:GITHUB_ACTION_INPUT_Name + Write-Host "Module name: [$moduleName]" + + $moduleSourceFolderPath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath $env:GITHUB_ACTION_INPUT_Path/$moduleName + if (-not (Test-Path -Path $moduleSourceFolderPath)) { + $moduleSourceFolderPath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath $env:GITHUB_ACTION_INPUT_Path + } + Write-Host "Source module path: [$moduleSourceFolderPath]" + if (-not (Test-Path -Path $moduleSourceFolderPath)) { + throw "Module path [$moduleSourceFolderPath] does not exist." + } + + $modulesOutputFolderPath = Join-Path $env:GITHUB_WORKSPACE $env:GITHUB_ACTION_INPUT_ModulesOutputPath + Write-Host "Modules output path: [$modulesOutputFolderPath]" + $docsOutputFolderPath = Join-Path $env:GITHUB_WORKSPACE $env:GITHUB_ACTION_INPUT_DocsOutputPath + Write-Host "Docs output path: [$docsOutputFolderPath]" +} + +$params = @{ + ModuleName = $moduleName + ModuleSourceFolderPath = $moduleSourceFolderPath + ModulesOutputFolderPath = $modulesOutputFolderPath + DocsOutputFolderPath = $docsOutputFolderPath +} + +Build-PSModuleDocumentation @params