This document describes how NetDiagram-PS is validated and published to the PowerShell Gallery.
-
PowerShell 7.4+
-
A PowerShell Gallery account and an API key (Account → API Keys)
-
Modules used for validation/publishing:
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force Install-Module -Name PSScriptAnalyzer -Force # PowerShellGet v2 ships with PowerShell; Publish-Module comes from it
Test-ModuleManifest ./NetDiagram-PS/NetDiagram-PS.psd1This must succeed with no errors. It confirms the manifest parses, the
RootModule resolves, and FunctionsToExport matches the module.
Invoke-ScriptAnalyzer -Path ./NetDiagram-PS -Recurse -Severity Warning,ErrorResolve anything at Error severity before publishing. Warnings are advisory.
On macOS or Linux:
./tests/run-tests.shExit 2 is CANNOT-RUN, not a passing or failing suite. Install the named
prerequisite or run CI before publishing.
./tests/run-tests.ps1All tests must pass on the target platform(s).
Publish-Module has no true -WhatIf for content, so verify what will be
packed by pointing at the module folder and confirming the version is new:
$manifest = Import-PowerShellDataFile ./NetDiagram-PS/NetDiagram-PS.psd1
$manifest.ModuleVersion # must be greater than the version already on the Gallery
Find-Module NetDiagram-PS -ErrorAction SilentlyContinue # what's live now (if anything)Bump ModuleVersion in NetDiagram-PS.psd1 and add a CHANGELOG.md entry for
any release. The Gallery rejects re-publishing an existing version.
$apiKey = '<your-powershell-gallery-api-key>' # do NOT commit this
Publish-Module -Path ./NetDiagram-PS -NuGetApiKey $apiKey -VerboseNotes:
-Pathpoints at the module folder (NetDiagram-PS/), not the repo root.- The manifest's
PrivateData.PSDataalready suppliesTags,LicenseUri,ProjectUri, andReleaseNotes, which populate the Gallery listing. - After publishing, confirm with
Find-Module NetDiagram-PS. - Use
Publish-Module(PowerShellGet). Do not usePublish-PSResource; an emptyIconUriin the manifest blocksPublish-PSResourcevalidation, which is why commit4a027ffremoved it.
git tag v<version>
git push origin v<version>-
ModuleVersionbumped inNetDiagram-PS.psd1 -
PrivateData.PSData.ReleaseNotesupdated -
CHANGELOG.mdentry added -
Test-ModuleManifestpasses -
Invoke-ScriptAnalyzerclean (no Errors) -
Invoke-Pestergreen -
Publish-Modulesucceeded andFind-Moduleshows the new version - Git tag pushed