diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b0f42a..5c985d1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -58,5 +58,24 @@ jobs: } Write-Host "Signed files summary:" Get-AuthenticodeSignature -FilePath $files - + - name: Publish + #Publish to PS Gallery + shell: pwsh + if: ${{ github.event_name != 'workflow_dispatch' }} + env: + SECRET: ${{ secrets.GC_PSGALLERY_APIKEY }} + run: | + write-host "Publishing from: $env:GITHUB_WORKSPACE\Module\$env:MODULE_NAME" + try + { + $env:PSModulePath = "$env:PSModulePath;$env:GITHUB_WORKSPACE\Module" + "PSModulePath: $env:PSModulePath" + Publish-Module -Path "$env:GITHUB_WORKSPACE\Module\$env:MODULE_NAME" -NuGetApiKey "$env:SECRET" + } + catch + { + Write-Host "Error: $($_.Exception)" + throw + } + diff --git a/.gitignore b/.gitignore index a4fe18b..6ed596b 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +.vscode/launch.json diff --git a/Module/SpfAnalyzer/SpfAnalyzer.psd1 b/Module/SpfAnalyzer/SpfAnalyzer.psd1 index 24a19a9..2de8322 100644 --- a/Module/SpfAnalyzer/SpfAnalyzer.psd1 +++ b/Module/SpfAnalyzer/SpfAnalyzer.psd1 @@ -12,7 +12,7 @@ RootModule = '.\SpfAnalyzer.psm1' # Version number of this module. -ModuleVersion = '0.0.1' +ModuleVersion = '0.0.2' # Supported PSEditions CompatiblePSEditions = @('Core') @@ -69,7 +69,7 @@ Description = 'Module provides functions for SPF record analysis.' # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @('Get-SpfRecord') +FunctionsToExport = @('Get-SpfRecord', 'Get-SpfRecordIpAddress', 'Get-SpfRecordIpNetwork') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() diff --git a/Module/SpfAnalyzer/SpfAnalyzer.psm1 b/Module/SpfAnalyzer/SpfAnalyzer.psm1 index 42eb494..f5e6d06 100644 --- a/Module/SpfAnalyzer/SpfAnalyzer.psm1 +++ b/Module/SpfAnalyzer/SpfAnalyzer.psm1 @@ -15,4 +15,36 @@ function Get-SPFRecord [DnsApi.Domain]::GetSpfRecord($Domain) } +function Get-SpfRecordIpNetwork +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory, ValueFromPipeline)] + [DnsApi.SpfRecord]$SpfRecord + ) + + process + { + Write-Verbose "Processing $spfRecord" + $SpfRecord.Entries | Where-Object { $_ -is [System.Net.IPNetwork] } + } +} + +function Get-SpfRecordIpAddress +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory, ValueFromPipeline)] + [DnsApi.SpfRecord]$SpfRecord + ) + + process + { + Write-Verbose "Processing $spfRecord" + $SpfRecord.Entries | Where-Object { $_ -is [System.Net.IPAddress] } + } +} + Init \ No newline at end of file