diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 0000000..3b0119d --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,43 @@ +name: Publish PowerShell Module + +on: + release: + types: [published] + +jobs: + publish-to-gallery: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: Set PSRepository to Trusted for PowerShell Gallery + shell: pwsh + run: | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + - name: Install AsBuiltReport.Core module + shell: pwsh + run: | + Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force + - name: Test Module Manifest + shell: pwsh + run: | + Test-ModuleManifest .\AsBuiltReport.Rubrik.CDM.psd1 + - name: Publish module to PowerShell Gallery + shell: pwsh + run: | + Publish-Module -Path ./ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose + tweet: + needs: publish-to-gallery + runs-on: ubuntu-latest + steps: + - uses: Eomm/why-don-t-you-tweet@v1 + # We don't want to tweet if the repository is not a public one + if: ${{ !github.event.repository.private }} + with: + # GitHub event payload + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release + tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Rubrik #AsBuiltReport #PowerShell #DataProtection" + env: + TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }} + TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} + TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} \ No newline at end of file diff --git a/AsBuiltReport.Rubrik.CDM.psd1 b/AsBuiltReport.Rubrik.CDM.psd1 index a77e584..4a4dd34 100644 Binary files a/AsBuiltReport.Rubrik.CDM.psd1 and b/AsBuiltReport.Rubrik.CDM.psd1 differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ef19bc..1fc1f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,17 @@ -# Rubrik CDM As Built Report Changelog +# :arrows_clockwise: Rubrik CDM As Built Report Changelog + +## [1.0.2] - 2022-10-19 + +### Changed +* Added new `Token` parameter to support the ability to connect with an API Token +* Changed Required Modules to AsBuiltReport.Core v1.2.0 +* Removed `StylePath` parameter from `Invoke-AsBuiltReport.Rubrik.CDM.ps1` + +### Added +* Added GitHub workflow for release actions + +### Fixed +* Fixes [#21](https://github.com/AsBuiltReport/AsBuiltReport.Rubrik.CDM/issues/21) ## [1.0.1] diff --git a/README.md b/README.md index a7d7fa5..81b9fea 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,12 @@ The `Healthcheck` section of the Rubrik CDM As Built Report is not currently uti ```powershell New-AsBuiltReport -Target 'cluster1.domain.local' -Username 'administrator@domain.local' -Password 'SuperSecret' -Report Rubrik.CDM -Format Html,Word -OutputFolderPath 'C:\Reports' -Timestamp ``` +- Generate HTML & Word reports using API Token authentication + + Generate a Rubrik CDM As Built Report for a cluster named 'cluster1.domain.local' using specified API Token. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Reports\' + ```powershell + New-AsBuiltReport -Target 'cluster1.domain.local' -Token '1234abcd' -Report Rubrik.CDM -Format Html,Word -OutputFolderPath 'C:\Reports' -Timestamp + ``` - Generate HTML & Text reports Generate a Rubrik CDM As Built Report for a cluster named 'cluster1.domain.local' using stored credentials. Export report to HTML & Text formats. Use default report style. Save reports to 'C:\Reports' diff --git a/Src/Public/Invoke-AsBuiltReport.Rubrik.CDM.ps1 b/Src/Public/Invoke-AsBuiltReport.Rubrik.CDM.ps1 index 980d1a4..0dcec16 100644 --- a/Src/Public/Invoke-AsBuiltReport.Rubrik.CDM.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Rubrik.CDM.ps1 @@ -5,7 +5,7 @@ function Invoke-AsBuiltReport.Rubrik.CDM { .DESCRIPTION Documents the configuration of the Rubrik CDM in Word/HTML/XML/Text formats using PScribo. .NOTES - Version: 1.0.1 + Version: 1.0.2 Author: Mike Preston Twitter: @mwpreston Github: mwpreston @@ -19,18 +19,13 @@ function Invoke-AsBuiltReport.Rubrik.CDM { param ( [String[]] $Target, [PSCredential] $Credential, - [String]$StylePath + [String] $Token ) # Import JSON Configuration for Options and InfoLevel $InfoLevel = $ReportConfig.InfoLevel $Options = $ReportConfig.Options - # If custom style not set, use default style - if (!$StylePath) { - & "$PSScriptRoot\..\..\AsBuiltReport.Rubrik.CDM.Style.ps1" - } - #region Script Functions #---------------------------------------------------------------------------------------------# # SCRIPT FUNCTIONS # @@ -51,7 +46,12 @@ function Invoke-AsBuiltReport.Rubrik.CDM { foreach ($brik in $Target) { try { Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Connection] Connecting to $($brik)" - $RubrikCluster = Connect-Rubrik -Server $brik -Credential $Credential -ErrorAction Stop + if ($Credential) { + $RubrikCluster = Connect-Rubrik -Server $brik -Credential $Credential -ErrorAction Stop + } + else { + $RubrikCluster = Connect-Rubrik -Server $brik -Token $Token -ErrorAction Stop + } } catch { Write-Error $_ }