Skip to content

Commit 7d80faa

Browse files
Document version resolution algorithm in Plan section
1 parent 4072d6e commit 7d80faa

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,43 @@ The Plan job is the single decision point of the workflow. It runs two steps in
117117

118118
The resolved version is passed into `Build-Module` so the manifest is stamped with the final version **before** the test stages run. The same artifact is then published unchanged by `Publish-Module`, which also uploads the zipped module as a GitHub Release asset. The bytes that are tested are the bytes that ship to the PowerShell Gallery and to GitHub Releases.
119119

120+
#### How version resolution works
121+
122+
The [Resolve-PSModuleVersion](https://github.com/PSModule/Resolve-PSModuleVersion) step reads configuration from `Settings.Publish.Module`:
123+
124+
| Key | Description |
125+
| --- | ----------- |
126+
| `ReleaseType` | `Release`, `Prerelease`, or `None`. |
127+
| `AutoPatching` | When `true`, a patch bump is applied even without a label. |
128+
| `IncrementalPrerelease` | When `true`, an incrementing counter is appended to prerelease tags. |
129+
| `DatePrereleaseFormat` | Optional .NET DateTime format string for date-based prerelease suffixes. |
130+
| `VersionPrefix` | Tag prefix (typically `v`). |
131+
| `MajorLabels`, `MinorLabels`, `PatchLabels` | Comma-separated PR labels that trigger the corresponding bump. |
132+
| `IgnoreLabels` | Comma-separated PR labels that suppress version creation. |
133+
134+
Resolution algorithm:
135+
136+
1. Loads the `pull_request` event payload and collects PR labels.
137+
2. Validates `ReleaseType`; applies `IgnoreLabels` override (suppresses release if matched).
138+
3. Picks the bump type: `MajorLabels` > `MinorLabels` > (`PatchLabels` or `AutoPatching`).
139+
4. Reads the latest version from GitHub Releases (`gh release list`) and the PowerShell Gallery (`Find-PSResource`),
140+
takes the higher of the two as the baseline.
141+
5. Bumps the baseline (major, minor, or patch).
142+
6. For prereleases, appends the sanitized branch name, optionally a `DatePrereleaseFormat` timestamp, and an
143+
incremental counter calculated from existing prereleases on the same baseline + branch.
144+
7. Emits outputs:
145+
146+
| Output | Description |
147+
| --- | --- |
148+
| `Version` | `Major.Minor.Patch` portion (for example `1.4.0`). |
149+
| `Prerelease` | Prerelease tag, empty when not a prerelease. |
150+
| `FullVersion` | Full string including prefix and prerelease (for example `v1.4.0-mybranch001`). |
151+
| `ReleaseType` | `Release`, `Prerelease`, or `None` when no bump label is found. |
152+
| `CreateRelease` | `true` when a release or prerelease should be created. |
153+
154+
When `ReleaseType` is `None`, when an `IgnoreLabels` label is present, or when no version bump label is found
155+
(and `AutoPatching` is disabled), `CreateRelease` is `false` and the version outputs are empty strings.
156+
120157
### Lint-Repository
121158

122159
[workflow](./.github/workflows/Lint-Repository.yml)

0 commit comments

Comments
 (0)