🌟 [Major]: Module manifests now stamped with the resolved version at build time (#136)
Module manifests are now stamped with the resolved version and prerelease tag at build time. The resulting artifact contains its final ModuleVersion (and PrivateData.PSData.Prerelease) before tests run, so the bytes that are tested are the bytes that ship.
Inputs on Build-PSModule
Build-PSModule now exposes new module-centric inputs:
| Input | Required | Description |
|---|---|---|
Name |
No | Name of the module to build. Defaults to the repository name. |
Version |
Yes | Module version (Major.Minor.Patch) to stamp into the manifest. Build fails with a clear error when omitted or malformed. |
Prerelease |
No | Prerelease tag (for example mybranch001) to stamp into PrivateData.PSData.Prerelease. When empty, no prerelease tag is written. |
OutputFolder |
No | Path (relative to WorkingDirectory) where the built module is placed. Defaults to outputs/module. |
Typical usage downstream of PSModule/Resolve-PSModuleVersion:
- name: Build module
uses: PSModule/Build-PSModule@v5
with:
Version: ${{ steps.resolve.outputs.Version }}
Prerelease: ${{ steps.resolve.outputs.Prerelease }}Breaking changes
Versionis now required. Callers that previously omitted it (relying on the999.0.0placeholder) must now pass an explicit version inMajor.Minor.Patchformat. Builds fail immediately with a clear error whenVersionis missing or malformed.
Technical details
action.yml: addsOutputFolder(defaultoutputs/module),Version(required: true), andPrereleaseinputs;Nameremains optional and still defaults to the repository name.src/main.ps1: readsOutputFolder,Version, andPrereleasefrom env; throws immediately whenVersionis missing or not inMajor.Minor.Patchformat.src/helpers/Build-PSModule.ps1:ModuleVersionparameter is now[Parameter(Mandatory)].src/helpers/Build/Build-PSModuleManifest.ps1:ModuleVersionis[Parameter(Mandatory)]; the999.0.0fallback is removed — the version is assigned directly.
Related PRs:
- PSModule/Resolve-PSModuleVersion#1 — emits the
VersionandPrereleasevalues consumed here. - PSModule/Publish-PSModule#71 — drops its own version stamping; expects the artifact to arrive pre-stamped.
- PSModule/Process-PSModule#342 — wires the workflow end-to-end.