From 2a649d5ef96f085174071bdc494fa43167231989 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Wed, 15 Oct 2025 13:20:47 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Move=20documentat?= =?UTF-8?q?ion=20and=20link=20to=20Process-PSModule=20(#119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This pull request significantly reduces and simplifies the documentation and metadata for the `Build-PSModule` GitHub Action, focusing on minimalism and removing detailed usage and implementation information. Documentation simplification: * The `README.md` file was almost entirely rewritten, removing all detailed explanations about supported module types, build steps, repository structure, manifest generation, and references. It now contains only a single line briefly describing the action and its relation to the PSModule framework. Metadata cleanup: * In `action.yml`, the action's `name` was simplified, and the `branding` section specifying the icon and color was removed to further streamline the action's metadata. --- README.md | 167 +---------------------------------------------------- action.yml | 5 +- 2 files changed, 2 insertions(+), 170 deletions(-) diff --git a/README.md b/README.md index 7cc352d..479041a 100644 --- a/README.md +++ b/README.md @@ -1,168 +1,3 @@ # Build-PSModule -This action "compiles" the module source code into an efficient PowerShell module that is ready to be published to the PowerShell Gallery. - -This GitHub Action is a part of the [PSModule framework](https://github.com/PSModule). It is recommended to use the [Process-PSModule workflow](https://github.com/PSModule/Process-PSModule) to automate the whole process of managing the PowerShell module. - -## Supported module types - -- Script module type -- Manifest module type - -## Supported practices and principles - -- [PowerShellGallery Publishing Guidelines and Best Practices](https://learn.microsoft.com/powershell/gallery/concepts/publishing-guidelines) are followed as much as possible. - -## How it works - -During the build process the following steps are performed: - -1. **Runs local build scripts:** Searches for any `*build.ps1` files anywhere in the repository. These scripts are executed in **alphabetical order by filename** (irrespective of their path). -This step lets you add custom build logic to process or modify the module contents before further build steps are performed. -1. **Copies the source code** of the module to an output folder. -1. **Builds the module manifest file** based on information from the GitHub repository and the source code. For more information, please read the [Module Manifest](#module-manifest) section. -1. **Builds the root module (.psm1) file** by combining source code and adding automation into the root module file. For more information, please read the [Root module](#root-module) section. -1. **Uploads the module artifact** so that it can be used in the next steps of the workflow. - -## Usage - -| Name | Description | Required | Default | -| ------------------ | ------------------------------------------------------ | -------- | --------- | -| `Name` | Name of the module to process. | `false` | | -| `ArtifactName` | Name of the artifact to upload. | `false` | `module` | -| `WorkingDirectory` | The working directory where the script will run from. | `false` | `'.'` | - -## Expected repository structure - -The action expects the module repository to be structured similarly to [Template-PSModule](https://github.com/PSModule/Template-PSModule). -## Root module - -The `src` folder may contain a 'root module' file. If present, the build function will disregard this file and build a new root module file based on the source code in the module folder. - -The root module file is the main file that is loaded when the module is imported. It is built from the source code files in the module folder in the following order: - -1. Adds a module header from `header.ps1` if it exists and removes the file from the module folder. -1. Adds a data loader that loads files from the `data` folder as variables in the module scope, if the folder exists. The variables are available using the `$script:` syntax. -1. Adds content from the following folders into the root module file. The files on the root of a folder are added before recursively processing subfolders (folders are processed in alphabetical order). Once a file is processed, it is removed from the module folder. - 1. `init` - 1. `classes/private` - 1. `classes/public` - 1. `functions/private` - 1. `functions/public` - 1. `variables/private` - 1. `variables/public` - 1. `*.ps1` on module root -1. Adds a `class` and `enum` exporter that exports the ones from the `classes/public` folder to the caller session, using [TypeAccelerators](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_classes?view=powershell-7.4#exporting-classes-with-type-accelerators). -1. Adds the `Export-ModuleMember` function to the end of the file, to ensure that only the functions, cmdlets, variables and aliases defined in the `public` folders are exported. - -## Module manifest - -The module manifest file describes the module and its contents. PowerShell uses it to load the module and its prerequisites. It also contains important metadata used by the PowerShell Gallery. If a file exists in the source code folder (`src`), it will be used as the base for the module manifest file. While most values in the module manifest are calculated during the build process, some values are preserved if specified in the source manifest file. - -During the module manifest build process the following steps are performed: - -1. Get the manifest file from the source code. If it does not exist, a new manifest file is created. -1. Generate and set the `RootModule` based on the module name. -1. Set a temporary `ModuleVersion` (this is updated during the release process by [Publish-PSModule](https://github.com/PSModule/Publish-PSModule)). -1. Set the `Author` and `CompanyName` based on the GitHub Owner. If a value exists in the source manifest file, that value is used. -1. Set the `Copyright` information based on a default text (`(c) 2024 >>OwnerName<<. All rights reserved.`) and includes the `Author`, `CompanyName` or both when applicable. If a value exists in the source manifest file, that value is used. -1. Set the `Description` based on the GitHub repository description. If a value exists in the source manifest file, that value is used. -1. Set various properties such as `PowerShellHostName`, `PowerShellHostVersion`, `DotNetFrameworkVersion`, `ClrVersion`, and `ProcessorArchitecture`. If values exist in the source manifest file, those values are used. -1. Get the list of files in the module source folder and set the `FileList` property in the manifest. -1. Get the list of required assemblies (`*.dll` files) from the `assemblies` and `modules` (depth = 1) folder and set the `RequiredAssemblies` property. -1. Get the list of nested modules (`*.psm1`, `*.ps1` and `*.dll` files one level down) from the `modules` folder and set the `NestedModules` property. -1. Get the list of scripts to process (`*.ps1` files) from the `scripts` folder and set the `ScriptsToProcess` property. This ensures that the scripts are loaded into the caller session. -1. Get the list of types to process by searching for `*.Types.ps1xml` files in the entire module source folder and set the `TypesToProcess` property. -1. Get the list of formats to process by searching for `*.Format.ps1xml` files in the entire module source folder and set the `FormatsToProcess` property. -1. Get the list of DSC resources to export by searching for `*.psm1` files in the `resources` folder and set the `DscResourcesToExport` property. -1. Get the list of functions, cmdlets, aliases, and variables from the respective `\public` folders and set the respective properties in the manifest. -1. Get the list of modules by searching for all `*.psm1` files in the entire module source folder (excluding the root module) and set the `ModuleList` property. -1. Gather information from source files to update `RequiredModules`, `PowerShellVersion`, and `CompatiblePSEditions` properties. -1. Gather additional information from the GitHub repository: - - `Tags` are generated from repository topics plus compatibility tags from the source files. - - `LicenseUri` is generated assuming there is a `LICENSE` file at the repository root. If a value exists in the source manifest file, that value is used. - - `ProjectUri` is set to the GitHub repository URL. If a value exists in the source manifest file, that value is used. - - `IconUri` is generated assuming there is an `icon.png` file in the `icon` folder at the repository root. If a value exists in the source manifest file, that value is used. -1. `ReleaseNotes` are not automated (could be set via PR or release description). -1. `PreRelease` is managed externally by [Publish-PSModule](https://github.com/PSModule/Publish-PSModule). -1. `RequireLicenseAcceptance` defaults to `false` unless specified in the source manifest. -1. `ExternalModuleDependencies` is not automated. If specified in the source manifest, that value is used. -1. `HelpInfoURI` is not automated. If specified in the source manifest, that value is used. -1. Create a new manifest file in the output folder with the gathered information, which also generates a new `GUID` for the module. - -### Sources for properties in the manifest file - -Below is a list of properties in the module manifest file and their sources: - -```powershell -@{ - RootModule = 'Utilities.psm1' # Generated as .psm1 from the module name; can be overridden in the source manifest. - ModuleVersion = '0.0.1' # Temporary version set during the build; updated by Publish‑PSModule during the release process. - CompatiblePSEditions = @() # Determined from #Requires -PSEdition statements in source files.; defaults to @('Core','Desktop') if none found. - GUID = '' # New GUID generated by New‑ModuleManifest when the manifest is created. - Author = 'PSModule' # Derived from the GitHub owner unless specified in the source manifest. - CompanyName = 'PSModule' # Derived from the GitHub owner unless specified in the source manifest. - Copyright = '(c) 2024 PSModule. All rights reserved.' # Default template; overridden if specified in the source manifest. - Description = 'This is a module.' # Taken from the repository description or the source manifest. - PowerShellVersion = '' # Derived from #Requires -Version statements in source files; blank if none. - PowerShellHostName = '' # Preserved from the source manifest if provided; otherwise omitted. - PowerShellHostVersion = '' # Preserved from the source manifest if provided; otherwise omitted. - DotNetFrameworkVersion = '' # Preserved from the source manifest if provided; otherwise omitted. - ClrVersion = '' # Preserved from the source manifest if provided; otherwise omitted. - ProcessorArchitecture = '' # Preserved from the source manifest if provided; otherwise omitted. - RequiredModules = @() # Gathered from #Requires -Modules statements in source files. - RequiredAssemblies = @() # Collected from assemblies/*.dll and modules/*.dll (depth = 1). - ScriptsToProcess = @() # Collected from scripts/*.ps1, loaded alphabetically into the caller session. - TypesToProcess = @() # Collected from *.Types.ps1xml files anywhere in the source folder. - FormatsToProcess = @() # Collected from *.Format.ps1xml files anywhere in the source folder. - NestedModules = @() # Collected from modules/* (.psm1, .ps1 or .dll one level down). - FunctionsToExport = @() # Collected from functions/public/*.ps1 files. - CmdletsToExport = @() # Preserved from the source manifest if provided; empty otherwise. - VariablesToExport = @() # Collected from variables/public/*.ps1 files. - AliasesToExport = '*' # Generated from functions/public/*.ps1. - DscResourcesToExport = @() # Collected from resources/*.psm1 files. - ModuleList = @() # Informational list of all additional *.psm1 files in the module. - FileList = @() # Informational list of all files in the module source folder. - PrivateData = @{ - PSData = @{ - Tags = @() # Generated from repository topics plus compatibility tags. - LicenseUri = '' # Public link to LICENSE file (or value from source manifest). - ProjectUri = '' # Public link to the GitHub repository (or value from source manifest). - IconUri = '' # Public link to icon\icon.png (or value from source manifest). - ReleaseNotes = '' # Not automated; supply via PR or release description. - Prerelease = '' # Managed by Publish‑PSModule; populated during release. - RequireLicenseAcceptance = $false # Defaults to $false unless specified in the source manifest. - ExternalModuleDependencies = @() # Not automated; preserved if present in the source manifest. - ExperimentalFeatures = @( - @{ - Name = "SomeExperimentalFeature" - Description = "This is an experimental feature." - } - ) - } - OtherKeys = @{} - } - HelpInfoURI = '' # Not automated; preserved if provided in the source manifest. - DefaultCommandPrefix = '' # Not automated; preserved if provided in the source manifest. -} -``` - -## Permissions - -This action does not require any special permissions. - -## References - -**Module manifest:** - -- [about_Module_Manifests](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_module_manifests) -- [How to write a PowerShell module manifest](https://learn.microsoft.com/powershell/scripting/developer/module/how-to-write-a-powershell-module-manifest) -- [New-ModuleManifest](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/new-modulemanifest) -- [Update-ModuleManifest](https://learn.microsoft.com/powershell/module/powershellget/update-modulemanifest) -- [Package metadata values that impact the PowerShell Gallery UI](https://learn.microsoft.com/powershell/gallery/concepts/package-manifest-affecting-ui#powershell-gallery-feature-elements-controlled-by-the-module-manifest) -- [PowerShellGallery Publishing Guidelines and Best Practices](https://learn.microsoft.com/en-us/powershell/gallery/concepts/publishing-guidelines#tag-your-package-with-the-compatible-pseditions-and-platforms) - -**Modules:** - -- [PowerShell scripting performance considerations](https://learn.microsoft.com/powershell/scripting/dev-cross-plat/performance/script-authoring-considerations) -- [PowerShell module authoring considerations](https://learn.microsoft.com/powershell/scripting/dev-cross-plat/performance/module-authoring-considerations) +This GitHub Action is a part of the [PSModule framework](https://github.com/PSModule). diff --git a/action.yml b/action.yml index 5117c56..27a6228 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,6 @@ -name: Build-PSModule (by PSModule) +name: Build-PSModule description: Build a PowerShell module to the PowerShell Gallery. author: PSModule -branding: - icon: package - color: gray-dark inputs: Name: From dff3bb9815b88c8ea019147fce5cbdcdb530e883 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 23:06:48 +0100 Subject: [PATCH 2/3] Bump actions/upload-artifact from 4 to 5 (#120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
Release notes

Sourced from actions/upload-artifact's releases.

v5.0.0

What's Changed

BREAKING CHANGE: this update supports Node v24.x. This is not a breaking change per-se but we're treating it as such.

New Contributors

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v5.0.0

v4.6.2

What's Changed

New Contributors

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.2

v4.6.1

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.1

v4.6.0

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.6.0

v4.5.0

What's Changed

New Contributors

... (truncated)

Commits
  • 330a01c Merge pull request #734 from actions/danwkennedy/prepare-5.0.0
  • 03f2824 Update github.dep.yml
  • 905a1ec Prepare v5.0.0
  • 2d9f9cd Merge pull request #725 from patrikpolyak/patch-1
  • 9687587 Merge branch 'main' into patch-1
  • 2848b2c Merge pull request #727 from danwkennedy/patch-1
  • 9b51177 Spell out the first use of GHES
  • cd231ca Update GHES guidance to include reference to Node 20 version
  • de65e23 Merge pull request #712 from actions/nebuk89-patch-1
  • 8747d8c Update README.md
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=4&new-version=5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 27a6228..a593fd5 100644 --- a/action.yml +++ b/action.yml @@ -32,7 +32,7 @@ runs: ${{ github.action_path }}/scripts/main.ps1 - name: Upload module artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: ${{ inputs.ArtifactName }} path: ${{ steps.build.outputs.ModuleOutputFolderPath }} From fe8cc14a7192066cc46cb9514659772ebde05849 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 09:23:46 +0100 Subject: [PATCH 3/3] Bump actions/checkout from 5 to 6 (#121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
Release notes

Sourced from actions/checkout's releases.

v6.0.0

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v5.0.0...v6.0.0

v6-beta

What's Changed

Updated persist-credentials to store the credentials under $RUNNER_TEMP instead of directly in the local git config.

This requires a minimum Actions Runner version of v2.329.0 to access the persisted credentials for Docker container action scenarios.

v5.0.1

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v5...v5.0.1

Changelog

Sourced from actions/checkout's changelog.

Changelog

V6.0.0

V5.0.1

V5.0.0

V4.3.1

V4.3.0

v4.2.2

v4.2.1

v4.2.0

v4.1.7

v4.1.6

v4.1.5

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=5&new-version=6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/Action-Test.yml | 6 +++--- .github/workflows/Auto-Release.yml | 2 +- .github/workflows/Linter.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 54e91a3..6799002 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Action-Test uses: ./ @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Action-Test uses: ./ @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Action-Test uses: ./ diff --git a/.github/workflows/Auto-Release.yml b/.github/workflows/Auto-Release.yml index 50a5a41..976b40c 100644 --- a/.github/workflows/Auto-Release.yml +++ b/.github/workflows/Auto-Release.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Auto-Release uses: PSModule/Auto-Release@v1 diff --git a/.github/workflows/Linter.yml b/.github/workflows/Linter.yml index 94f34b0..1962629 100644 --- a/.github/workflows/Linter.yml +++ b/.github/workflows/Linter.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0