Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestpowershellmodule.ps1
More file actions
Latest commit
42 lines (37 loc) · 1.32 KB
/
Copy pathtestpowershellmodule.ps1
File metadata and controls
42 lines (37 loc) · 1.32 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
param (
[string]$ModuleName,
[string]$Source="",
[string]$Output="",
[string]$Debug='false'
)
try
{
Write-Host"::group::Starting the Test PowerShell Module task..."
Write-Host"::group::Setting up variables"
$Debug= [System.Convert]::ToBoolean($Debug)
$sourcePath=if ([string]::IsNullOrEmpty($Source)) { $env:GITHUB_WORKSPACE } else { Join-Path$env:GITHUB_WORKSPACE$Source }
$outputPath=if ([string]::IsNullOrEmpty($Output)) { Join-Path$env:GITHUB_WORKSPACE"output" } else { Join-Path$env:GITHUB_WORKSPACE$Output }
$Module=Get-ChildItem-Path $sourcePath-Filter "$ModuleName.psd1"-Recurse
$ModuleRoot=$Module.Directory.FullName
$Destination=Join-Path$outputPath$ModuleName
$modulePath=Join-Path$Destination"$ModuleName.psm1"
$ManifestPath=Join-Path$Destination"$ModuleName.psd1"
if ($Debug)
{
Write-Host"ModuleName : $ModuleName"
Write-Host"SourcePath : $sourcePath"
Write-Host"OutputPath : $outputPath"
Write-Host"ModuleRoot : $ModuleRoot"
Write-Host"modulePath : $modulePath"
Write-Host"ManifestPath : $ManifestPath"
Write-Host"Destination : $Destination"
}
Test-ModuleManifest-Path $ManifestPath-Verbose
Import-Module$Destination-Verbose
Get-Module-Name $ModuleName
}
catch
{
Write-Host"##[error]An error occurred: $($_.Exception.Message)"
exit1
}