Skip to content

🌟 [Major]: Module version resolution now available as a standalone action#1

Draft
Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
mainfrom
feat/326-implement-action
Draft

🌟 [Major]: Module version resolution now available as a standalone action#1
Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
mainfrom
feat/326-implement-action

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented May 22, 2026

Module version resolution is now available as a standalone action. Workflows can call it before building so the resolved version is stamped into the artifact at build time, making the bytes that are tested the bytes that ship.

New: Standalone Resolve-PSModuleVersion action

The action consumes the JSON Settings output from PSModule/Get-PSModuleSettings and emits:

Output Description
Version Major.Minor.Patch portion of the resolved version.
Prerelease Prerelease tag, empty when not a prerelease.
FullVersion Full version string including VersionPrefix and prerelease tag.
ReleaseType Release, Prerelease, or None when no version bump label is present.
CreateRelease true when a release or prerelease should be created.

Typical usage in the Plan job:

- name: Resolve module version
  id: resolve
  uses: PSModule/Resolve-PSModuleVersion@v1
  env:
    GH_TOKEN: ${{ github.token }}
  with:
    Settings: ${{ steps.settings.outputs.Settings }}

- name: Build module
  uses: PSModule/Build-PSModule@v5
  with:
    Version: ${{ steps.resolve.outputs.Version }}
    Prerelease: ${{ steps.resolve.outputs.Prerelease }}

The action validates Settings.Publish.Module.ReleaseType, applies IgnoreLabels overrides, picks the bump type from PR labels (MajorLabels > MinorLabels > PatchLabels / AutoPatching), then computes the next version from the higher of the latest GitHub Release and the latest PowerShell Gallery version. For prereleases it appends the sanitized branch name, optional DatePrereleaseFormat timestamp, and an incremental counter calculated from existing prereleases on the same baseline + branch.

Technical Details

  • action.yml: composite action with Settings (required JSON), Name, WorkingDirectory, Debug, Verbose, Version, Prerelease inputs. Installs PSModule/Install-PSModuleHelpers and PSSemVer before running the script.
  • scripts/main.ps1: ports the version-resolution logic that previously lived in Publish-PSModule/src/init.ps1. Reads configuration from PSMODULE_RESOLVE_PSMODULEVERSION_INPUT_Settings JSON instead of separate env vars. Emits outputs via $env:GITHUB_OUTPUT. Cleanup-tag discovery stays in Publish-PSModule/cleanup.ps1 and is intentionally out of scope here.
  • .github/workflows/Action-Test.yml: added 6 test jobs covering patch, minor, major, auto-patch, ignore-label, and None scenarios using a fake PR event override.
  • README replaces the template scaffold with the action's contract and usage examples.

Related PRs:

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀 [Feature]: Module version resolution now available as a standalone action 🌟 [Major]: Module version resolution now available as a standalone action May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move version calculation to a Plan job (Resolve-PSModuleVersion) so Build and Publish never calculate or mutate versions

1 participant