Skip to content

🪲[Bug]: Publish Module is failing #528

Description

Describe the bug

When the CI run, after checking all your changes, fixing BC in my repo I can still see this

 Publish module to PowerShell Gallery using API key from environment.
    Find-PSResource: /home/runner/work/PSWEE/PSWEE/_wf/.github/actions/Publish-PSModule/src/publish.ps1:148
    Line |
     148 |  … edPackage = Find-PSResource -Name $name -Version $publishPSVersion -R …
         |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         | Package with name 'PSWEE', version '1.3.1' could not be found in
         | repository 'PSGallery'.
    Error: Process completed with exit code 1.

For me there is an issue on the code on src/publish.ps1. Since every brand-new version is, by definition, not yet on the Gallery it cannot proceed. And due to -ErrorAction Stop we cannot go further.

In .github/actions/Publish-PSModule/src/publish.ps1, region "Publish to PSGallery":

$publishedPackage = Find-PSResource -Name $name -Version $publishPSVersion -Repository PSGallery -ErrorAction Stop
if ($publishedPackage) {
    # "already published" / resume notice
} else {
    Publish-PSResource -Path $modulePath -Repository PSGallery -ApiKey $psGalleryApiKey
}

Version information

NA

To reproduce

Push something on a repo using PSModule

Code snippet

NA

Relevant output

NA

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions