Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.186
Language: C# Updated: 2026-11-04
Command

New-ConfigurationExecute

Module
PSPublishModule
Inputs
None
Outputs
PowerForge.ConfigurationActionSegment

Creates a module pipeline lifecycle action.

Syntax

New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
-InlineScript <String>
[-Name <String>]
[-PreferWindowsPowerShell]
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
#
Parameter set: Inline
New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
-FilePath <String>
[-Name <String>]
[-PreferWindowsPowerShell]
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
#
Parameter set: File
New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
[-Name <String>]
[-PreferWindowsPowerShell]
-ScriptBlock <ScriptBlock>
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
#
Parameter set: ScriptBlock

Description

Lifecycle actions run PowerShell at a named module pipeline context point such as AfterStaging, AfterManifest, or BeforePublish. PowerForge writes a stable JSON context file before each action and exposes its path through the POWERFORGE_CONTEXT environment variable.

Use lifecycle actions for project-specific preparation, generated-file adjustments, artifact checks, and release guardrails that need a precise pipeline context. Configuration segment order does not control execution order; the At value does.

Examples

Run an inline action after staging

New-ConfigurationExecute -Name 'Inspect staged module' -At AfterStaging -InlineScript '$ctx = Get-Content $env:POWERFORGE_CONTEXT | ConvertFrom-Json; Get-ChildItem $ctx.ModuleRoot'

Runs the inline PowerShell after the module staging context exists.

Run a script file before publishing

New-ConfigurationExecute -Name 'Release guard' -At BeforePublish -FilePath '.\Build\Test-ReleaseReady.ps1' -TimeoutSeconds 120

Runs a repository script before publish steps execute.

Parameters

-At ModulePipelineActionStage optional
Stable module pipeline lifecycle point where the action runs.
Possible values: BeforeDependencies, AfterDependencies, BeforeVersioning, AfterVersioning, BeforeStaging, AfterStaging, BeforeBuild, AfterBuild, BeforeManifest, AfterManifest, BeforeDocumentation, AfterDocumentation, BeforeFormatting, AfterFormatting, BeforeValidation, AfterValidation, BeforeTests, AfterTests, BeforeSigning, AfterSigning, BeforeArtefacts, AfterArtefacts, BeforePublish, AfterPublish, BeforeInstall, AfterInstall
-ContinueOnError SwitchParameter optional
When set, logs a failed action and lets the pipeline continue.
-Disabled SwitchParameter optional
When set, disables the action while keeping it in configuration.
-Environment Hashtable optional
Environment variable overrides passed to the action process.
-InlineScript String requiredsets: Inline
Inline PowerShell script text.
-Name String optional
Friendly action name shown in progress and result output.
-PreferWindowsPowerShell SwitchParameter optional
When set, prefer Windows PowerShell before pwsh on Windows.
-TimeoutSeconds Int32 optional
Action timeout in seconds. Defaults to five minutes.
-WorkingDirectory String optional
Optional working directory. Relative paths resolve from the project root.
-FilePath String requiredsets: File
Path to a PowerShell script file. Relative paths resolve from the project root.
-ScriptBlock ScriptBlock requiredsets: ScriptBlock
Inline PowerShell script block. The script block text is executed out-of-process.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.