-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBuild-Module-step.yml
More file actions
25 lines (21 loc) · 1.28 KB
/
Build-Module-step.yml
File metadata and controls
25 lines (21 loc) · 1.28 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
parameters:
sourcePath: "$(Build.SourcesDirectory)/*/build.psd1"
destination: "$(Build.BinariesDirectory)"
semVer: $[dependencies.GitVersion.outputs['GitVersion.NuGetVersion']]
steps:
- powershell: |
Write-Host "Using PSModulePath: $($Env:PSModulePath)"
foreach ($BuildManifest in Get-ChildItem "${{ parameters.sourcePath }}") {
# Build-Module currently doesn't guarantee the module name will be in the output
$BuildInfo = Import-LocalizedData -BaseDirectory $BuildManifest.Directory.FullName -FileName $BuildManifest.Name
# These are all possible aliases for "Path" which you might have used in the manifest
$ModulePath = switch ($BuildInfo) {
{ $_.SourcePath } { $_.SourcePath; break; }
{ $_.Path } { $_.Path; break; }
{ $_.ModuleManifest } { $_.ModuleManifest; break; }
}
$destination = Join-Path "${{ parameters.destination }}" ([IO.Path]::GetFileNameWithoutExtension( $ModulePath ))
Write-Host Build-Module -SourcePath $BuildManifest -Destination $destination -SemVer "${{ parameters.semVer }}" "-Verbose"
Build-Module -SourcePath $BuildManifest -Destination $destination -SemVer "${{ parameters.semVer }}" -Verbose
}
displayName: 'Build-Module -SourcePath $sourcePath'