Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

PsModuleActions

A collection of reusable GitHub Actions for building and managing PowerShell modules.

Actions

build-module

Compiles a PowerShell module by concatenating individual command files into a single .psm1 file and updating the FunctionsToExport list in the module manifest (.psd1).

Inputs

Input Required Default Description
module-name Yes Name of the module to build
root-path No ${{ github.workspace }} Root folder of the repository that uses this action

Usage

- name: Build module
  uses: GreyCorbel/PsModuleActions/build-module@main
  with:
    module-name: MyModule

Expected Repository Layout

The build action expects the following folder structure in your module repository:

<repo-root>/
├── Commands/
│   ├── ModuleStart.ps1          # Optional: prepended to the .psm1 before all commands
│   ├── ModuleInitialization.ps1 # Optional: appended to the .psm1 after all commands
│   ├── Public/
│   │   ├── Get-Something.ps1    # Exported functions (added to FunctionsToExport)
│   │   └── Set-Something.ps1
│   └── Internal/
│       ├── Invoke-Helper.ps1    # Private/internal functions (not exported)
│       └── ConvertTo-Model.ps1
└── Module/
    └── <ModuleName>/
        ├── <ModuleName>.psm1    # Output: generated by the build action
        └── <ModuleName>.psd1    # Module manifest (FunctionsToExport is updated automatically)

Build Process

  1. The contents of Commands/ModuleStart.ps1 (if present) are written to the top of the .psm1.
  2. All .ps1 files under Commands/Public/ are appended. Each file's base name is recorded as an exported function.
  3. All .ps1 files under Commands/Internal/ are appended.
  4. The contents of Commands/ModuleInitialization.ps1 (if present) are appended at the end.
  5. The FunctionsToExport field in <ModuleName>.psd1 is updated to reflect the public command names discovered in step 2.

About

Shared code to be used in PS module actions

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages