|
1 | 1 | # Publish-PSModule |
2 | 2 |
|
3 | 3 | This GitHub Action is a part of the [PSModule framework](https://github.com/PSModule). |
4 | | - |
5 | | -It publishes a **pre-versioned** PowerShell module artifact to the PowerShell Gallery and creates a matching GitHub |
6 | | -Release. The compressed module is also uploaded as a release asset so the GitHub Release page exposes the exact bytes |
7 | | -that were tested and pushed to the Gallery. |
8 | | - |
9 | | -## Breaking change — v3.0.0 |
10 | | - |
11 | | -`Publish-PSModule` no longer calculates the next version or mutates the module manifest. The artifact passed in must |
12 | | -already contain the final `ModuleVersion` (and `Prerelease` tag, if any). |
13 | | - |
14 | | -The following inputs were **removed**: |
15 | | - |
16 | | -- `AutoPatching` |
17 | | -- `IncrementalPrerelease` |
18 | | -- `DatePrereleaseFormat` |
19 | | -- `VersionPrefix` |
20 | | -- `MajorLabels`, `MinorLabels`, `PatchLabels`, `IgnoreLabels` |
21 | | -- `ReleaseType` |
22 | | - |
23 | | -To migrate, run [`PSModule/Resolve-PSModuleVersion`](https://github.com/PSModule/Resolve-PSModuleVersion) to compute |
24 | | -the version and pass it to [`PSModule/Build-PSModule`](https://github.com/PSModule/Build-PSModule) so the artifact is |
25 | | -stamped before it is tested. The publish action then ships that artifact without any post-build manipulation. |
26 | | - |
27 | | -This makes the tested artifact identical to the published artifact (see |
28 | | -[PSModule/Process-PSModule#326](https://github.com/PSModule/Process-PSModule/issues/326)). |
29 | | - |
30 | | -## What it does |
31 | | - |
32 | | -1. Downloads the `module` artifact uploaded by `Build-PSModule`. |
33 | | -2. Reads `ModuleVersion` and `PrivateData.PSData.Prerelease` from the downloaded manifest. |
34 | | -3. Installs `RequiredModules` declared by the manifest. |
35 | | -4. Publishes the module to the PowerShell Gallery (`Publish-PSResource`). |
36 | | -5. Creates a GitHub Release with the same tag. |
37 | | -6. Zips the module folder and uploads it as a release asset (`<Name>-<Version>.zip`). |
38 | | -7. Optionally cleans up prerelease tags whose name matches the current PR branch. |
39 | | - |
40 | | -## Inputs |
41 | | - |
42 | | -| Name | Description | Required | Default | |
43 | | -| -------------------------- | --------------------------------------------------------------------------------------- | -------- | ---------------- | |
44 | | -| `Name` | Name of the module. Defaults to the repository name. | No | Repository name | |
45 | | -| `ModulePath` | Path to the folder containing the `<Name>/` module subdirectory from Build-PSModule. | No | `outputs/module` | |
46 | | -| `APIKey` | PowerShell Gallery API key. | Yes | | |
47 | | -| `AutoCleanup` | Delete prerelease tags matching the PR branch after a stable release. | No | `true` | |
48 | | -| `WhatIf` | Log the changes that would be made without publishing, creating, or deleting anything. | No | `false` | |
49 | | -| `WorkingDirectory` | The working directory where the script will run from. | No | `.` | |
50 | | -| `UsePRTitleAsReleaseName` | Use the PR title as the release name (otherwise the version string is used). | No | `false` | |
51 | | -| `UsePRBodyAsReleaseNotes` | Use the PR body as the release notes (otherwise `--generate-notes` is used). | No | `true` | |
52 | | -| `UsePRTitleAsNotesHeading` | Prefix the release notes with the PR title as an H1 heading linking to the PR. | No | `true` | |
0 commit comments