Skip to content

Commit c54f3ff

Browse files
committed
Build NuGet package
1 parent abbd214 commit c54f3ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/deploy-module.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,18 @@ jobs:
5050
- name: Build module artifact
5151
shell: pwsh
5252
run: |
53+
5354
$moduleManifest = Get-ChildItem -Path . -Filter '*.psd1' -Recurse | Select-Object -First 1
5455
$moduleName = $moduleManifest.BaseName
5556
$artifactPath = "$env:GITHUB_WORKSPACE/artifact"
57+
58+
# Build NuGet package (.nupkg) for the PowerShell module
5659
New-Item -ItemType Directory -Path $artifactPath -Force | Out-Null
60+
Publish-Module -Path $moduleManifest.Directory.FullName -NuGetApiKey 'AnyValue' -Repository 'LocalRepo' -Force -SkipAutomaticTags -WhatIf
61+
$nupkgFile = Get-ChildItem -Path "$env:USERPROFILE/.local/share/powershell/Modules" -Filter '*.nupkg' -Recurse | Sort-Object LastWriteTime -Descending | Select-Object -First 1
62+
if ($nupkgFile) {
63+
Copy-Item -Path $nupkgFile.FullName -Destination $artifactPath
64+
}
5765
Copy-Item -Path "$($moduleManifest.Directory.FullName)\*.ps*1)" -Destination $artifactPath\$moduleName
5866
Copy-Item -Path "$($moduleManifest.Directory.FullName)\public" -Destination $artifactPath\$moduleName -Recurse
5967
Copy-Item -Path "$($moduleManifest.Directory.FullName)\private" -Destination $artifactPath\$moduleName -Recurse

0 commit comments

Comments
 (0)