Commit e1b338d
🚀 [Feature]: Add ReleaseType input for explicit release control (#59)
The action now supports explicit control over the release type through
the new `ReleaseType` input parameter. You can specify whether to create
a stable release, prerelease, or skip releasing entirely—without relying
on automatic detection from PR state and labels. The workflow has also
been restructured into three phases (initialization, publishing,
cleanup) that run conditionally, improving efficiency when only cleanup
is needed.
- Part of PSModule/Process-PSModule#73
- Part of PSModule/Process-PSModule#265
## New ReleaseType input parameter
A new `ReleaseType` input allows you to explicitly control the release
behavior:
| Value | Description |
|-------|-------------|
| `Release` | Create a stable release (default) |
| `Prerelease` | Create a prerelease |
| `None` | Do not create any release |
This input is designed to work with `Get-PSModuleSettings`, which
pre-calculates the appropriate release type based on your workflow
context:
```yaml
- uses: PSModule/Publish-PSModule@v2
with:
APIKey: ${{ secrets.PSGALLERY_API_KEY }}
ReleaseType: ${{ fromJson(inputs.Settings).Publish.Module.ReleaseType }}
AutoCleanup: ${{ fromJson(inputs.Settings).Publish.Module.AutoCleanup }}
```
## Restructured workflow execution
The action now runs in three separate phases, each executing only when
needed:
1. **Initialize Publish Context** (`init.ps1`) – Calculates version,
validates inputs, and stores context in environment variables
2. **Publish Module** (`publish.ps1`) – Downloads artifact, updates
manifest, publishes to PSGallery, and creates GitHub release (runs only
when `ShouldPublish` is true)
3. **Cleanup Prereleases** (`cleanup.ps1`) – Deletes old prerelease tags
(runs only when `ShouldCleanup` is true)
This separation means the action skips unnecessary steps. For example,
when a PR is closed without merging, the workflow can run cleanup
independently without downloading artifacts or attempting to publish.
## Backward compatibility
The `ReleaseType` parameter defaults to `Release`, maintaining current
behavior for merged PRs targeting the default branch. Existing workflows
continue to work without modification.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent ebbfeec commit e1b338d
7 files changed
Lines changed: 665 additions & 520 deletions
File tree
- .github/workflows
- scripts
- helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | | - | |
85 | | - | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
96 | 123 | | |
97 | 124 | | |
98 | 125 | | |
99 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
0 commit comments