-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ps1
More file actions
56 lines (49 loc) · 2.03 KB
/
main.ps1
File metadata and controls
56 lines (49 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidUsingWriteHost', '',
Justification = 'Want to just write to the console, not the pipeline.'
)]
[CmdletBinding()]
param(
[string]$Name = $env:DOCUMENT_PSMODULE_INPUT_Name,
[bool]$ShowSummaryOnSuccess = $env:DOCUMENT_PSMODULE_INPUT_ShowSummaryOnSuccess -eq 'true'
)
$PSStyle.OutputRendering = 'Ansi'
'Microsoft.PowerShell.PlatyPS' | ForEach-Object {
Write-Output "Installing module: $_"
$retryCount = 5
$retryDelay = 10
for ($i = 0; $i -lt $retryCount; $i++) {
try {
Install-PSResource -Name $_ -WarningAction SilentlyContinue -TrustRepository -Repository PSGallery
break
} catch {
Write-Warning "Installation of $($psResourceParams.Name) failed with error: $_"
if ($i -eq $retryCount - 1) {
throw
}
Write-Warning "Retrying in $retryDelay seconds..."
Start-Sleep -Seconds $retryDelay
}
}
Import-Module -Name $_
}
$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative
Write-Host "::group::Loading helper scripts from [$path]"
Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object {
Write-Host "$_"
. $_
}
Write-Host '::group::Loading inputs'
$env:GITHUB_REPOSITORY_NAME = $env:GITHUB_REPOSITORY -replace '.+/'
$moduleSourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
$modulesOutputFolderPath = Join-Path -Path . -ChildPath 'outputs/module'
$docsOutputFolderPath = Join-Path -Path . -ChildPath 'outputs/docs'
$params = @{
ModuleName = [string]::IsNullOrEmpty($Name) ? $env:GITHUB_REPOSITORY_NAME : $Name
ModuleSourceFolderPath = $moduleSourceFolderPath
ModulesOutputFolderPath = $modulesOutputFolderPath
DocsOutputFolderPath = $docsOutputFolderPath
ShowSummaryOnSuccess = $ShowSummaryOnSuccess
}
[pscustomobject]$params | Format-List | Out-String
Build-PSModuleDocumentation @params