Skip to content

Commit fd33c37

Browse files
Decouple prerelease cleanup from publish artifact
Run prerelease cleanup independently when no module artifact is produced by gating publish-only steps behind CreateRelease and driving cleanup behavior from ReleaseType. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent c4af7da commit fd33c37

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.github/actions/Publish-PSModule/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ inputs:
1010
description: Path to the folder containing the <Name>/ module subdirectory from Build-PSModule.
1111
required: false
1212
default: outputs/module
13+
CreateRelease:
14+
description: When true, downloads the module artifact and runs publish.ps1 (PowerShell Gallery + GitHub Release flow).
15+
required: false
16+
default: 'false'
17+
ReleaseType:
18+
description: Resolved release type from settings (Release, Prerelease, None). Used to control prerelease cleanup behavior.
19+
required: false
20+
default: None
1321
APIKey:
1422
description: PowerShell Gallery API Key.
1523
required: true
@@ -50,12 +58,14 @@ runs:
5058
Install-PSResource -Name Microsoft.PowerShell.PSResourceGet -Repository PSGallery -TrustRepository
5159
5260
- name: Download module artifact
61+
if: inputs.CreateRelease == 'true'
5362
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
5463
with:
5564
name: ${{ inputs.ArtifactName }}
5665
path: ${{ inputs.ModulePath }}
5766

5867
- name: Publish Module
68+
if: inputs.CreateRelease == 'true'
5969
shell: pwsh
6070
working-directory: ${{ inputs.WorkingDirectory }}
6171
env:

.github/workflows/Publish-Module.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
with:
4646
Name: ${{ fromJson(inputs.Settings).Name }}
4747
ModulePath: outputs/module
48+
CreateRelease: ${{ fromJson(inputs.Settings).Module.CreateRelease }}
49+
ReleaseType: ${{ fromJson(inputs.Settings).Module.ReleaseType }}
4850
APIKey: ${{ secrets.APIKey }}
4951
WhatIf: ${{ github.repository == 'PSModule/Process-PSModule' }}
5052
UsePRTitleAsReleaseName: ${{ fromJson(inputs.Settings).Publish.Module.UsePRTitleAsReleaseName }}

0 commit comments

Comments
 (0)