Publish-PSModule bundles three distinct responsibilities into a single composite action: version calculation and release-type determination (init.ps1), PowerShell Gallery publishing and GitHub Release creation (publish.ps1), and prerelease cleanup (cleanup.ps1). Each responsibility has different triggers, different failure modes, and different consumers.
Request
Current experience
The action's publish.ps1 script (lines 106–216) performs two independent operations in sequence:
- Publish to PowerShell Gallery (lines 106–138): Updates the module manifest, calls
Publish-PSResource, and comments on the PR
- Create GitHub Release (lines 140–216): Creates a tagged release with release notes and comments on the PR
These operations have independent failure modes:
- Gallery publish can fail (API down, duplicate version, invalid manifest) while GitHub Release would succeed
- GitHub Release can fail (permission issue, tag conflict) while Gallery publish already succeeded
- There is no rollback if one succeeds and the other fails
Additionally, init.ps1 (407 lines) contains version calculation and release-type determination logic that is identical to Release-GHRepository (see #326).
Desired experience
Publish-PSModule has a single responsibility: publish a module to the PowerShell Gallery. GitHub Release creation is handled by Release-GHRepository (or a shared release action). Version calculation is handled by a shared versioning library (see #326).
Acceptance criteria
Publish-PSModule only publishes to the PowerShell Gallery
- GitHub Release creation is handled by a separate action or workflow step
- A Gallery publish failure does not prevent creating a GitHub Release (and vice versa)
- Version calculation logic exists in exactly one place (shared with
Release-GHRepository)
- PR commenting for each operation is scoped to the responsible action
Related issues
Technical decisions
Approach: Refactor Publish-PSModule into a focused Gallery-publish action. The Publish-Module.yml workflow orchestrates the full publish pipeline by calling separate actions in sequence:
- Version calculation — shared module or action (from Move version calculation to a Plan job (Resolve-PSModuleVersion) so Build and Publish never calculate or mutate versions #326)
- Gallery publish — slimmed
Publish-PSModule action
- GitHub Release —
Release-GHRepository action (already exists)
- Prerelease cleanup — shared cleanup function (from Move version calculation to a Plan job (Resolve-PSModuleVersion) so Build and Publish never calculate or mutate versions #326)
Breaking change: The Publish-PSModule action interface changes. Since it is only consumed by Publish-Module.yml within Process-PSModule, the blast radius is contained.
Dependency on #326: This issue depends on #326 (shared versioning logic) being completed first, or at least being designed concurrently. Without shared versioning, splitting the action just moves the duplication.
Implementation plan
Publish-PSModule action changes
Publish-Module.yml workflow changes
Testing
Publish-PSModulebundles three distinct responsibilities into a single composite action: version calculation and release-type determination (init.ps1), PowerShell Gallery publishing and GitHub Release creation (publish.ps1), and prerelease cleanup (cleanup.ps1). Each responsibility has different triggers, different failure modes, and different consumers.Request
Current experience
The action's
publish.ps1script (lines 106–216) performs two independent operations in sequence:Publish-PSResource, and comments on the PRThese operations have independent failure modes:
Additionally,
init.ps1(407 lines) contains version calculation and release-type determination logic that is identical toRelease-GHRepository(see #326).Desired experience
Publish-PSModulehas a single responsibility: publish a module to the PowerShell Gallery. GitHub Release creation is handled byRelease-GHRepository(or a shared release action). Version calculation is handled by a shared versioning library (see #326).Acceptance criteria
Publish-PSModuleonly publishes to the PowerShell GalleryRelease-GHRepository)Note
This violates the Single Responsibility Principle (SRP). It is directly related to #210 (separate release from publish), #176 (move version generation to build), and #326 (extract shared versioning logic).
Related issues
Technical decisions
Approach: Refactor
Publish-PSModuleinto a focused Gallery-publish action. ThePublish-Module.ymlworkflow orchestrates the full publish pipeline by calling separate actions in sequence:Publish-PSModuleactionRelease-GHRepositoryaction (already exists)Breaking change: The
Publish-PSModuleaction interface changes. Since it is only consumed byPublish-Module.ymlwithin Process-PSModule, the blast radius is contained.Dependency on #326: This issue depends on #326 (shared versioning logic) being completed first, or at least being designed concurrently. Without shared versioning, splitting the action just moves the duplication.
Implementation plan
Publish-PSModule action changes
publish.ps1init.ps1(replace with shared module call)cleanup.ps1(replace with shared module call)Publish-PSResourcecall, Gallery-specific PR commentPublish-Module.yml workflow changes
Release-GHRepository(or shared release action) after Gallery publishif:conditions)Testing