Update Create-Release.ps1 to test module import

This commit is contained in:
GraceSolutions
2025-04-15 00:53:57 -04:00
parent 4e137e927e
commit 7a2331bf74
+14 -1
View File
@@ -52,10 +52,23 @@ foreach (`$dll in `$dllFiles) {
} }
} }
# Export all cmdlets from the PSD1 file # PowerShell will automatically export the cmdlets based on the [Cmdlet] attribute
"@ "@
Set-Content -Path $psm1Path -Value $psm1Content Set-Content -Path $psm1Path -Value $psm1Content
# Test the module import
Write-Host "Testing module import..."
try {
Import-Module "$PSScriptRoot\..\output\PSOPNSenseAPI\PSOPNSenseAPI.psd1" -Force -Verbose
$cmdlets = Get-Command -Module PSOPNSenseAPI
Write-Host "Successfully imported module with $($cmdlets.Count) cmdlets"
Remove-Module PSOPNSenseAPI -Force -ErrorAction SilentlyContinue
}
catch {
Write-Error "Failed to import module: $_"
exit 1
}
# Create a release archive # Create a release archive
$zipFile = "output\PSOPNSenseAPI-$version.zip" $zipFile = "output\PSOPNSenseAPI-$version.zip"
Compress-Archive -Path "output\PSOPNSenseAPI\*" -DestinationPath $zipFile -Force Compress-Archive -Path "output\PSOPNSenseAPI\*" -DestinationPath $zipFile -Force