Commit 03c0f8b
authored
🌟 [Major]: Version calculation removed — artifact must be pre-stamped before publish (#71)
`Publish-PSModule` no longer calculates or mutates the module version.
The artifact passed in must already contain the final `ModuleVersion`
(and `Prerelease` tag, if any) stamped by the upstream build. Published
GitHub Releases now include a downloadable zip of the exact module
folder that was tested and pushed to the Gallery.
## Breaking Changes
Version-calculation inputs have been removed. Callers must supply a
pre-stamped artifact:
**Removed inputs:**
- `AutoPatching`
- `IncrementalPrerelease`
- `DatePrereleaseFormat`
- `VersionPrefix`
- `MajorLabels`, `MinorLabels`, `PatchLabels`, `IgnoreLabels`
- `ReleaseType`
**Migration:** Consumers on `PSModule/Process-PSModule` get this for
free — the workflow resolves the version in the Plan job and stamps it
during Build. Direct callers outside of `Process-PSModule` must use
[`Resolve-PSModuleVersion`](https://github.com/PSModule/Resolve-PSModuleVersion)
to compute the version and
[`Build-PSModule`](https://github.com/PSModule/Build-PSModule) v5+ to
stamp it before invoking this action.
## New: Module zip uploaded to GitHub Release
After creating a GitHub Release, the module folder is zipped
(`<Name>-<Version>.zip`) and uploaded as a release asset. The zip
preserves the `<Name>/` directory structure so it can be extracted
directly into a PowerShell module path.
## Changed: Cleanup only runs after stable releases
The cleanup step (which removes old prerelease tags/releases) now only
executes when the publish was a stable release. Previously it could
inadvertently delete the just-published prerelease. Cleanup also filters
on `isPrerelease` to avoid accidentally deleting stable releases whose
tag happens to match the derived prerelease name.
## Technical Details
- Deleted `src/init.ps1` (the old version-calculation script).
- `src/publish.ps1` reads `ModuleVersion` and `Prerelease` directly from
the downloaded manifest via `Import-PowerShellDataFile`, validates
3-part format, then publishes untouched via `Publish-PSResource`.
- `Test-ModuleManifest` is called as advisory validation
(non-terminating) since the built artifact may reference
`RequiredModules` not installed on the runner. Structural validation is
enforced by explicit regex guards on `ModuleVersion` and `Prerelease`.
- `src/cleanup.ps1` derives the prerelease name from the PR head ref,
filters on `isPrerelease`, and explicitly excludes the just-published
release tag from deletion.
- `action.yml` cleanup step gated on
`env.PSMODULE_PUBLISH_PSMODULE_CONTEXT_IsPrerelease != 'true'`.
- `GITHUB_ENV` writes use `utf8NoBOM` encoding to prevent BOM
corruption.
- Zip upload and temp file cleanup wrapped in `try/finally` for reliable
cleanup on failure.
<details><summary>Related issues</summary>
- Fixes PSModule/Process-PSModule#326
- PSModule/Process-PSModule#342
- PSModule/Resolve-PSModuleVersion#1
- PSModule/Build-PSModule#136
</details>1 parent 72572ee commit 03c0f8b
10 files changed
Lines changed: 426 additions & 567 deletions
File tree
- .github/workflows
- src
- tests/outputs
- module-prerelease/PSModuleTest
- module-unstamped/PSModuleTest
- module/PSModuleTest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 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 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 20 | | |
57 | 21 | | |
58 | 22 | | |
| |||
73 | 37 | | |
74 | 38 | | |
75 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
76 | 44 | | |
77 | 45 | | |
78 | 46 | | |
| |||
85 | 53 | | |
86 | 54 | | |
87 | 55 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 56 | | |
108 | | - | |
109 | 57 | | |
110 | 58 | | |
111 | | - | |
| 59 | + | |
112 | 60 | | |
113 | 61 | | |
114 | 62 | | |
115 | | - | |
116 | 63 | | |
117 | 64 | | |
118 | 65 | | |
| |||
126 | 73 | | |
127 | 74 | | |
128 | 75 | | |
129 | | - | |
| 76 | + | |
130 | 77 | | |
131 | 78 | | |
132 | 79 | | |
133 | 80 | | |
| 81 | + | |
134 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
15 | 34 | | |
| 35 | + | |
16 | 36 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
21 | 43 | | |
| 44 | + | |
22 | 45 | | |
23 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
24 | 50 | | |
25 | 51 | | |
26 | 52 | | |
| |||
29 | 55 | | |
30 | 56 | | |
31 | 57 | | |
32 | | - | |
| 58 | + | |
| 59 | + | |
33 | 60 | | |
| 61 | + | |
| 62 | + | |
34 | 63 | | |
35 | 64 | | |
36 | 65 | | |
| |||
47 | 76 | | |
48 | 77 | | |
49 | 78 | | |
| 79 | + | |
0 commit comments