Publish-PSGallery.ps1

[CmdletBinding(SupportsShouldProcess = $true)]
param(
    [Parameter(Mandatory = $true)]
    [string]$ApiKey,

    [string]$Repository = 'PSGallery'
)

$moduleRoot = $PSScriptRoot
$manifestPath = Join-Path $moduleRoot 'PSSecRules.psd1'

Write-Host "Validating module manifest: $manifestPath"
Test-ModuleManifest -Path $manifestPath -ErrorAction Stop | Out-Null

Write-Host "Publishing module folder: $moduleRoot"
Publish-Module -Path $moduleRoot -NuGetApiKey $ApiKey -Repository $Repository -WhatIf:$WhatIfPreference -Verbose

Write-Host 'Done.'