mirror of
https://github.com/PowerShell/PSDesiredStateConfiguration
synced 2026-06-21 13:45:25 +00:00
28 lines
1.0 KiB
PowerShell
28 lines
1.0 KiB
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
function DoBuild
|
|
{
|
|
Write-Verbose -Verbose -Message "Running DoBuild to layout module at: '${OutDirectory}/${ModuleName}'"
|
|
Copy-Item "${SrcPath}/*" "${OutDirectory}/${ModuleName}" -Recurse
|
|
Copy-Item -Recurse "${HelpPath}/${Culture}" "${OutDirectory}/${ModuleName}"
|
|
}
|
|
|
|
function DoPackage
|
|
{
|
|
try {
|
|
$repoName = [guid]::NewGuid().ToString()
|
|
$modulePath = Join-Path $OutDirectory $ModuleName
|
|
$null = Register-PSRepository -Name $repoName -InstallationPolicy Trusted -SourceLocation $OutDirectory
|
|
|
|
Write-Verbose -Verbose -Message "Publishing module from: '$modulePath'"
|
|
Publish-Module -Path $modulePath -Repository $repoName
|
|
|
|
$nupkgPath = (Get-ChildItem -Path $OutDirectory -Filter "$ModuleName*.nupkg" | Select-Object -First 1).FullName
|
|
Write-Verbose -Verbose -Message "Created package: $nupkgPath"
|
|
}
|
|
finally {
|
|
Unregister-PSRepository -Name $repoName
|
|
}
|
|
}
|