PSScriptModule - PowerShell Script Module Template
A modern PowerShell module template with CI/CD, testing, semantic versioning, and automated publishing
A production-ready PowerShell module template with built-in CI/CD, testing, versioning, and publishing workflows using GitHub Actions.
π‘ Why This Template?
Most PowerShell module repositories start the same way: a few scripts, some manual testing, and CI/CD added laterβoften inconsistently. This template flips that model.
PSScriptModule is opinionated by design.
It gives you a complete, production-grade foundation so you can focus on writing PowerShell codeβnot wiring pipelines.
What makes it different?
-
CI/CD from day one
Build, test, analyze, version, and publish automatically using GitHub Actions. -
Best practices baked in
Module structure, testing, security scanning, and documentation follow proven PowerShell and DevOps conventions. -
Automation over ceremony
Versioning, changelogs, releases, and publishing happen automatically based on your commits and pull requests. -
Works everywhere
Tested on Windows, Linux, and macOS, with optional devcontainer support for consistent environments. -
Scales with your project
Suitable for prototypes, internal tooling, and fully open-source modules published to the PowerShell Gallery.
If youβve ever thought βI just want to write PowerShell, not build pipelinesβ, this template is for you.
π¬ How to Use This Template
- Click the "Use PowerShell Module Template" button below or use GitHub's "Use this template" button
- Fill in your module name and description
- Wait about 20 seconds for the automated bootstrap workflow to complete
- Refresh the page to see your customized repository
π¦ Features
When you create a module from this template, you get a fully wired, production-ready PowerShell module from day one. But wait, thereβs more!
β CI/CD Ready
- End-to-end GitHub Actions workflows for build, test, release, and publishing
- Dependency management with intelligent caching for faster pipelines
- Cross-platform validation on Windows, Linux, and macOS
- Automated publishing to PowerShell Gallery and NuGet.org
β Development Environment
- Opinionated VS Code setup (settings and recommended extensions)
- Pre-configured build, run, and debug tasks
- Devcontainer support for consistent, sandboxed development environments
β Version Management
- Semantic versioning powered by GitVersion
- GitHub Flowβbased release strategy
- Commit-driven version bumps using
+semver:keywords - Automatic changelog generation from merged pull requests
β Code Quality and Testing
- Pester-based unit testing framework
- Code coverage reporting
- Built-in security scanning with PSScriptAnalyzer, InjectionHunter, and CodeQL
β Project Documentation
- Markdown-based help generation using PlatyPS
- Auto-generated external help for
Get-Help - Structured, comprehensive documentation in the
/docsdirectory
π Project Structure
PSScriptModule/
βββ π .devcontainer/ // Devcontainer configuration for VS Code
βββ π .github/ // GitHub Actions workflows and issue templates
β βββ π workflows/ // CI/CD pipeline definitions
β βββ π ISSUE_TEMPLATE/ // Issue and pull request templates
βββ π .vscode/ // VS Code workspace settings and recommended extensions
βββ π PSScriptModule.build.ps1 // Invoke-Build script with all build tasks
βββ π requirements.psd1 // PSDepend configuration for dependencies
βββ π gitversion.yml // GitVersion configuration
βββ π src/ // Source code
β βββ π PSScriptModule.psd1 // Module manifest
β βββ π Classes/ // Classes definitions
β βββ π Public/ // Public functions (exported)
β βββ π Private/ // Private functions (internal only)
βββ π tests/ // Test suites
β βββ π PSScriptAnalyzer/ // Static code analysis tests
β βββ π InjectionHunter/ // Security vulnerability tests
βββ π docs/ // Markdown documentation
π Getting Started
Prerequisites
Required:
- PowerShell 7.0+
- Visual Studio Code with PowerShell extension (recommended)
- Git for version control
Optional dependencies:
- GitHub Copilot for enhanced development experience
- Docker or Rancher Desktop for consistent development environments in devcontainers
- PowerShell Gallery account for publishing
Quick Start
-
Click on the "Use this template" button above to create your own repository from this template. Personalize it by updating the name, description, and visibility.
-
Clone your new repository locally:
git clone https://github.com/YourUsername/YourModuleName.git cd YourModuleName -
Install dependencies:
Note: If using the devcontainer (
.devcontainer/folder), dependencies are pre-installed. Skip this step.# Install PSDepend if not already installed Install-Module -Name PSDepend -Scope CurrentUser -Force # Install all project dependencies Invoke-PSDepend -Path ./requirements.psd1 -Install -Import -Force -
Run build and test tasks:
# Run default build (Clean + Build) Invoke-Build # Run all tests Invoke-Build Test -
You are now ready to start developing your PowerShell module!
Next Steps
After setup, customize your module:
-
Update Module Manifest (
src/YourModuleName.psd1):- Set
Author,CompanyName,Copyright - Update
DescriptionandTags
Note: Do not change
ModuleVersion,RootModule, orFunctionsToExport- it is managed automatically - Set
-
Start Developing:
- Add functions to
src/Public/(exported) orsrc/Private/(internal) - Create corresponding
.Tests.ps1files
- Add functions to
-
Push your changes and open a pull request to trigger CI/CD workflows
π Documentation
Comprehensive documentation is available in the docs/ directory:
- π Getting Started Guide - Initial setup, prerequisites, and your first function
- π οΈ Development Guide - Creating functions, building, testing, and generating help
- π CI/CD & Publishing Guide - Automated pipelines, versioning, and PowerShell Gallery publishing
π€ Contributing
Contributions are welcome! Whether itβs bug fixes, improvements, or ideas for new features, your input helps make this template better for everyone. Please see CONTRIBUTING.md for details on:
- Pull request workflow
- Code style and conventions
- Testing and quality requirements
β Support This Project
If this template saves you time or helps your projects succeed, consider supporting it:
- β Star the repository to show your support
- π Share it with other PowerShell developers
- π¬ Provide feedback via issues or discussions
- β€οΈ Sponsor ongoing development via GitHub Sponsors
Built with β€οΈ by Warehouse Finds