A self-contained PowerShell module providing a set of utility functions, organized for easy import and publishing to the PowerShell Gallery.
- Main entry point:
PSF.psm1
(imports all functions fromfunctions/
) - Module manifest:
PSF.psd1
(controls exported functions and metadata) - CI/CD: Automated with GitHub Actions (
.github/workflows/deploy.yml
)
PSF.psm1 # Module entry point
PSF.psd1 # Module manifest
functions/ # Each function as a separate .ps1 file
Get-oAuthToken.ps1
Get-PublicIP.ps1
Get-RandomPassword.ps1
Get-Updates.ps1
tests/ # Pester tests for each function
Get-RandomPassword.Tests.ps1
.github/workflows/ # CI/CD pipeline
deploy.yml
Install from the PowerShell Gallery:
Install-Module -Name PSF
Import the module:
Import-Module PSF
- Create
functions/New-Function.ps1
. - Dot-source it in
PSF.psm1
. - Add to
FunctionsToExport
inPSF.psd1
. - Add
tests/New-Function.Tests.ps1
(use Pester).
-
Run all tests:
.\.ExecuteTests.ps1
-
Validate manifest:
Test-ModuleManifest -Path .\PSF.psd1
- On push/PR to
master
, the workflow:- Runs tests and validates the manifest
- Versions the module using GitVersion
- Tags the release
- Publishes to the PowerShell Gallery
- Only functions listed in
FunctionsToExport
inPSF.psd1
are public - Only functions dot-sourced in
PSF.psm1
are loaded - No wildcards in export lists
- Each function should have a corresponding test file
- No external dependencies (except standard PowerShell modules and GitHub Actions)