-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ps1
More file actions
55 lines (48 loc) · 1.76 KB
/
main.ps1
File metadata and controls
55 lines (48 loc) · 1.76 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
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidUsingWriteHost', '',
Justification = 'Want to just write to the console, not the pipeline.'
)]
[CmdletBinding()]
param()
$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative
Set-GitHubLogGroup "Loading helper scripts from [$path]" {
Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object {
Write-Host "$_"
. $_
}
}
$env:GITHUB_REPOSITORY_NAME = $env:GITHUB_REPOSITORY -replace '.+/'
Set-GitHubLogGroup 'Loading inputs' {
$moduleName = if ([string]::IsNullOrEmpty($env:PSMODULE_BUILD_PSMODULE_INPUT_Name)) {
$env:GITHUB_REPOSITORY_NAME
} else {
$env:PSMODULE_BUILD_PSMODULE_INPUT_Name
}
$sourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
$moduleOutputFolderPath = Join-Path $pwd -ChildPath 'outputs/module'
[pscustomobject]@{
moduleName = $moduleName
sourceFolderPath = $sourceFolderPath
moduleOutputFolderPath = $moduleOutputFolderPath
} | Format-List | Out-String
}
Set-GitHubLogGroup '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 {
Set-GitHubLogGroup "Build local scripts - [$_]" {
. $_
}
}
}
$params = @{
ModuleName = $moduleName
ModuleSourceFolderPath = $sourceFolderPath
ModuleOutputFolderPath = $moduleOutputFolderPath
}
Build-PSModule @params
"ModuleOutputFolderPath=$moduleOutputFolderPath" >> $env:GITHUB_OUTPUT
exit 0