Skip to content

PowerShell Module Publisher

Automated PowerShell module publication to NuGet with manifest generation, validation, and semantic versioning.

The Problem

Publishing PowerShell modules to the PowerShell Gallery involves tedious manual steps. Update the version number in your manifest, regenerate the PSD1 file with correct metadata, run Test-ModuleManifest to catch errors, then publish with the right NuGet API key.

Do this manually every release and you'll make mistakes. Forget to update the version, ship an invalid manifest, or publish with the wrong credentials.

For example, I built a module (PDS) that needed regular updates across multiple projects. Managing manual releases was slowing me down and introducing errors.

The Solution

This action automates the entire PowerShell module release process. It generates manifests with correct versions, validates them, and publishes to the PowerShell Gallery. GitVersion handles semantic versioning based on your Git history.

Push code to your main branch, and the module gets versioned, validated, and published automatically. No manual intervention, no version number mistakes.

Key Capabilities

  • Automatic versioning: GitVersion generates semantic versions from Git history
  • Manifest generation: Creates PSD1 files with correct version and metadata
  • Pre-publication validation: Tests manifests to catch errors before publishing
  • Gallery integration: Publishes directly to the PowerShell Gallery (NuGet)

Quick Example

yaml
- name: Publish module
  uses: michielvha/publish-pwsh-module-action@v2
  with:
    psd1Path: "pwsh/module/MyModule.psd1"
    psm1Path: "pwsh/module/MyModule.psm1"
    companyName: "mycompany.com"
    apiKey: ${{ secrets.NUGET_API_KEY }}
    rootModule: "MyModule"
    description: "My PowerShell module"

The action handles versioning, manifest creation, validation, and publication.

Why This Matters

Manual release processes don't scale. When you're maintaining multiple PowerShell modules or releasing frequently, manual steps become a bottleneck.

Automated releases also improve quality. The manifest is always generated consistently, validation runs before publication, and versioning follows semantic standards. No more "oops, forgot to update the version number" releases.

This is particularly valuable for platform teams maintaining shared PowerShell tooling. You want developers using your latest functions without manual coordination. Automated publishing means fixes and features reach users immediately after merging to main.

For detailed usage, NuGet setup instructions, and examples, see the GitHub repository.