Skip to content

Commit 4cf52d8

Browse files
Document source-bound publication and immutable retry requirements
1 parent 84fcb9c commit 4cf52d8

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

‎.github/actions/Publish-PSModule/README.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Publish-PSModule
22

3-
Publishes a pre-versioned PowerShell module artifact to the PowerShell Gallery. GitHub Release creation is intentionally handled by the separate [Release-PSModule](../Release-PSModule/README.md) action.
3+
Publishes a pre-versioned, tested PowerShell module artifact to the PowerShell Gallery after source-bound ownership preflight. GitHub Release creation is handled by the separate [Release-PSModule](../Release-PSModule/README.md) action.
4+
5+
The publisher verifies the original source, exact resolved tag/version, producing repository/PR or direct-release context, and tested bytes before an external versioned-artifact mutation. An absent version is reserved with a create-only annotated tag containing the file-tree and ZIP SHA-256 proof. Existing tags are never updated or deleted.
6+
7+
An existing Gallery package is retained only when its raw nupkg payload matches that proof and the tested artifact. Package code is never imported to establish ownership. Unknown legacy proof, foreign tags/releases/assets, changed claims, authentication errors, and API failures stop publication explicitly.
48

59
## Inputs
610

@@ -10,6 +14,9 @@ Publishes a pre-versioned PowerShell module artifact to the PowerShell Gallery.
1014
| `ModulePath` | Path containing the built `<Name>/` module directory. | No | `.PSModule/module` |
1115
| `ArtifactName` | Name of the module artifact to download. | No | `module` |
1216
| `PSGALLERY_API_KEY` | PowerShell Gallery API key. | Yes | N/A |
17+
| `ReleaseTag` | Exact tag already resolved as `Publish.Module.Resolution.FullVersion`. | Yes | N/A |
18+
| `CommitSha` | Immutable commit that produced the tested artifact. | No | Original workflow `GITHUB_SHA` |
19+
| `PullRequest` | Normalized producing-PR context; empty for a direct stable release. | No | Empty |
1320
| `WhatIf` | Logs publishing operations without publishing the module. | No | `false` |
1421
| `WorkingDirectory` | Directory where the publishing script runs. | No | `.` |
1522

@@ -27,6 +34,11 @@ This action does not provide outputs.
2734
ModulePath: .PSModule/module
2835
ArtifactName: module
2936
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
37+
ReleaseTag: ${{ fromJson(inputs.Settings).Publish.Module.Resolution.FullVersion }}
38+
CommitSha: ${{ fromJson(inputs.Settings).Context.CommitSha }}
39+
PullRequest: ${{ toJson(fromJson(inputs.Settings).Context.PullRequest) }}
3040
```
3141
32-
Use [Release-PSModule](../Release-PSModule/README.md) in a separate workflow step to create the GitHub release from the same artifact.
42+
Provide `GH_TOKEN` with contents-write access scoped to the consumer repository. The reusable workflow supplies its existing GitHub App token and resolved context internally.
43+
44+
Use [Release-PSModule](../Release-PSModule/README.md) in a separate step to create the GitHub release from the same source and tested artifact. A retry must retain the original coordinates and bytes; unproven legacy publication requires reviewed forward-only recovery, not numeric guessing, retagging, or metadata changes.

‎.github/actions/Release-PSModule/README.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release-PSModule
22

3-
Creates or resumes a GitHub release for a pre-versioned PowerShell module artifact. The action attaches the exact built module ZIP to the release and reports the result on the source pull request.
3+
Creates or resumes a GitHub release for a pre-versioned, tested PowerShell module artifact. The action verifies the same immutable source/context/artifact claim as the Gallery publisher, attaches repeatable module ZIP bytes, and reports the result on the producing pull request when available.
44

55
## Inputs
66

@@ -10,6 +10,8 @@ Creates or resumes a GitHub release for a pre-versioned PowerShell module artifa
1010
| `ModulePath` | Path containing the built `<Name>/` module directory. | No | `.PSModule/module` |
1111
| `ArtifactName` | Name of the module artifact to download. | No | `module` |
1212
| `ReleaseTag` | Full GitHub release tag resolved by `Resolve-PSModuleVersion`. | Yes | N/A |
13+
| `CommitSha` | Original immutable build source for stable and prerelease tags. | No | Original workflow `GITHUB_SHA` |
14+
| `PullRequest` | Normalized producing-PR context; empty for a direct stable release. | No | Empty |
1315
| `WhatIf` | Logs release operations without creating or uploading anything. | No | `false` |
1416
| `WorkingDirectory` | Directory where the release script runs. | No | `.` |
1517
| `UsePRTitleAsReleaseName` | Uses the pull request title as the release name. | No | `false` |
@@ -36,6 +38,12 @@ Pass the Plan job's resolved `FullVersion` as `ReleaseTag` so the configured tag
3638
ModulePath: .PSModule/module
3739
ArtifactName: module
3840
ReleaseTag: ${{ fromJson(inputs.Settings).Publish.Module.Resolution.FullVersion }}
41+
CommitSha: ${{ fromJson(inputs.Settings).Context.CommitSha }}
42+
PullRequest: ${{ toJson(fromJson(inputs.Settings).Context.PullRequest) }}
3943
```
4044
41-
The action requires a `pull_request` event and a built module artifact. If a release already exists for `ReleaseTag`, it resumes by replacing the module ZIP, which makes retrying a partial release safe.
45+
The action supports normalized pull-request context and direct stable releases. Provide repository-scoped contents-write `GH_TOKEN` access and the original tested artifact/source. Tags resolve to actual commits, including annotated tags; mutable branch names and release target hints are not ownership proof.
46+
47+
Release creation and upload recheck the tag, provenance, and artifact identity. A missing upload can resume. An existing asset is retained only when its published SHA-256 matches the exact local ZIP; differing, ambiguous, or unverifiable bytes stop the action. Uploads never use `--clobber`, and tags are never retargeted.
48+
49+
Complete authored or generated prerelease notes precede a final repository/producing-PR/source footer. A matching tag/source does not authorize another PR's release. Legacy records without proof require reviewed forward-only recovery; the action does not fabricate provenance or alter consumer metadata.

‎docs/content/guides/versioning-and-releases.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,27 @@ Each publication produces three linked, immutable artifacts:
7373
Release names and notes can be generated from the pull request — see
7474
[Configuring the pipeline](configuring-the-pipeline.md).
7575

76+
## Publication ownership
77+
78+
Before taking a Gallery version, the publisher verifies the immutable consumer source, the Plan job's exact
79+
resolved version/tag, the producing repository/PR or direct-release context, and the tested module bytes.
80+
An absent version tag is reserved with a create-only annotated claim containing the tested file-tree and
81+
release-ZIP SHA-256 digests. Existing tags are not updated or deleted.
82+
83+
Standalone tags, annotated tags, releases, provenance footers, module assets, and exact Gallery packages must
84+
agree with that claim. Raw nupkg files are read without importing package code. Verified absence is different
85+
from an authentication/API failure or unknown ownership proof; errors and unavailable proof stop publication.
86+
87+
The publisher rechecks the claim and tested files immediately before Gallery upload. GitHub release creation
88+
and upload repeat the ownership checks. Missing uploads may resume, identical published ZIP bytes are retained,
89+
and differing or unverifiable assets are never clobbered. Complete authored or generated prerelease notes remain
90+
before their final producing-repository/PR/source footer.
91+
92+
A retry retains the original source, resolved coordinates, release context, and tested bytes. Legacy incomplete
93+
publications without proof require reviewed forward-only recovery, not a guessed version, retagging, asset
94+
replacement, or metadata edits. See the [publisher](https://github.com/PSModule/Process-PSModule/tree/main/.github/actions/Publish-PSModule)
95+
and [release action](https://github.com/PSModule/Process-PSModule/tree/main/.github/actions/Release-PSModule) contracts.
96+
7697
## Linear versioning
7798

7899
Only a single linear ancestry of versions is maintained. Old versions are not patched: if a security issue is found on

0 commit comments

Comments
 (0)