File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,25 @@ try {
2929 # Publish to PowerShell Gallery
3030 # Ensure the default repository is registered, PSGallery
3131 if (-not (Get-PSRepository - Name ' PSGallery' - ErrorAction SilentlyContinue)) {
32+ Write-Host " PSGallery repository not found. Registering..."
3233 Register-PSRepository - Default
3334 }
34- Publish-Module - Path $ModulePath - NuGetApiKey $ApiKey - SkipAutomaticTags
35+
36+ # Verify PSGallery is properly configured
37+ $psGallery = Get-PSRepository - Name ' PSGallery' - ErrorAction Stop
38+ Write-Host " PSGallery repository found:"
39+ Write-Host " SourceLocation: $ ( $psGallery.SourceLocation ) "
40+ Write-Host " PublishLocation: $ ( $psGallery.PublishLocation ) "
41+ Write-Host " InstallationPolicy: $ ( $psGallery.InstallationPolicy ) "
42+
43+ # Publish to PowerShell Gallery with explicit repository name
44+ Write-Host " Publishing module from: $ModulePath "
45+ Publish-Module - Path $ModulePath - NuGetApiKey $ApiKey - Repository ' PSGallery' - SkipAutomaticTags - Verbose
3546
3647 Write-Host " Successfully published to PowerShell Gallery"
3748}
3849catch {
3950 Write-Host " ##vso[task.logissue type=error]Error publishing to PowerShell Gallery. Error was $ ( $_.Exception.Message ) "
51+ Write-Host " ##vso[task.logissue type=error]Full error details: $ ( $_.Exception | Format-List * - Force | Out-String ) "
4052 exit 1
4153}
You can’t perform that action at this time.
0 commit comments