From 61cfabdc2eea3ebf1727badb46813e090b3f3a99 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 29 Nov 2022 15:35:59 -0500 Subject: [PATCH 1/4] Update check_and_publish.yml --- .github/workflows/check_and_publish.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check_and_publish.yml b/.github/workflows/check_and_publish.yml index a1ab356..65cfc21 100644 --- a/.github/workflows/check_and_publish.yml +++ b/.github/workflows/check_and_publish.yml @@ -3,25 +3,22 @@ name: Check and Publish on: push: branches: [main] - pull_request: - branches: [main] jobs: checkpublish: name: Check and Publish runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run PSScriptAnalyzer - uses: microsoft/psscriptanalyzer-action@v1.0 + uses: microsoft/psscriptanalyzer-action@v1.1 with: path: .\BitwardenPS recurse: true includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' output: results.sarif - # Upload the SARIF file generated in the previous step - name: Upload SARIF results file uses: github/codeql-action/upload-sarif@v2 with: From 21438a0c094a031fa062c5aaa55bb3f8411eb1e8 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 7 Dec 2022 17:07:19 -0500 Subject: [PATCH 2/4] Update readme --- .gitignore | 1 + README.md | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index e69de29..cd0df9c 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +Output \ No newline at end of file diff --git a/README.md b/README.md index 189de83..be713ad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # BitwardenPS Module +[![BitwardenPSDownloads]][BitwardenPSGallery] ![BitwardenPSBuild] This module interacts with the Bitwarden Public API and the Vault API. @@ -85,3 +86,8 @@ text : @{text=Super secret text; hidden=False} # Notes This module is a work in progress. Pull requests are welcome. + + +[BitwardenPSDownloads]: https://img.shields.io/powershellgallery/dt/BitwardenPS +[BitwardenPSGallery]: https://www.powershellgallery.com/packages/BitwardenPS/ +[BitwardenPSBuild]: https://img.shields.io/github/workflow/status/johnduprey/BitwardenPS/Check%20and%20Publish/main \ No newline at end of file From af1fc702fc7278a1f401f816a8c5f8464786dbf1 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Fri, 16 Dec 2022 12:41:44 -0500 Subject: [PATCH 3/4] Replace Test-NetConnection with Test-Connection --- BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 b/BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 index 07848ca..07cfc87 100644 --- a/BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 +++ b/BitwardenPS/Public/Vault API/REST/Start-RestServer.ps1 @@ -63,16 +63,11 @@ function Start-RestServer { Write-Verbose 'Starting REST server' $Proc = Start-Process -FilePath $bw.Path -ArgumentList $Arguments -NoNewWindow -PassThru -ErrorAction Stop - $OldProgPref = $global:ProgressPreference - $global:ProgressPreference = 'SilentlyContinue' - do { - $VaultRest = Test-NetConnection -ComputerName $Hostname -Port $Port -InformationLevel Quiet -WarningAction SilentlyContinue + $VaultRest = Test-Connection -TargetName $Hostname -TcpPort $Port Start-Sleep -Milliseconds 200 } while (-not $VaultRest) - $global:ProgressPreference = $OldProgPref - $script:BwRestServer = [PSCustomObject]@{ PID = $Proc.Id Port = $Port From 80a591c022a0a03f47557572665bfe0a9087ab57 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Fri, 16 Dec 2022 12:47:48 -0500 Subject: [PATCH 4/4] Update readme and workflows --- .github/workflows/psscriptanalyzer.yml | 24 +++++++++++++++++ .../{check_and_publish.yml => publish.yml} | 27 +++++++------------ README.md | 12 +++++---- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/psscriptanalyzer.yml rename .github/workflows/{check_and_publish.yml => publish.yml} (50%) diff --git a/.github/workflows/psscriptanalyzer.yml b/.github/workflows/psscriptanalyzer.yml new file mode 100644 index 0000000..49cd285 --- /dev/null +++ b/.github/workflows/psscriptanalyzer.yml @@ -0,0 +1,24 @@ +name: Run PSScriptAnalyzer + +on: + push: + branches: [main] + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Run PSScriptAnalyzer + uses: microsoft/psscriptanalyzer-action@v1.1 + with: + path: .\BitwardenPS + recurse: true + output: results.sarif + + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif \ No newline at end of file diff --git a/.github/workflows/check_and_publish.yml b/.github/workflows/publish.yml similarity index 50% rename from .github/workflows/check_and_publish.yml rename to .github/workflows/publish.yml index 65cfc21..39a990a 100644 --- a/.github/workflows/check_and_publish.yml +++ b/.github/workflows/publish.yml @@ -1,29 +1,16 @@ -name: Check and Publish +name: Publish New Version on: push: - branches: [main] + tags: '*' jobs: - checkpublish: - name: Check and Publish + publish: + name: Publish runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Run PSScriptAnalyzer - uses: microsoft/psscriptanalyzer-action@v1.1 - with: - path: .\BitwardenPS - recurse: true - includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' - output: results.sarif - - - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: results.sarif - - name: PowerShell script uses: Amadevus/pwsh-script@v2.0.3 id: Build-Module @@ -32,6 +19,12 @@ jobs: Install-Module ModuleBuilder -Force Build-Module + - name: Update Metadata + uses: natescherer/update-powershell-metadata-action@v2 + with: + path: .\Output\BitwardenPS + version: ${{ github.ref_name }} + - name: Publish PowerShell Module uses: pcgeek86/publish-powershell-module-action@v20 with: diff --git a/README.md b/README.md index be713ad..062b883 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # BitwardenPS Module -[![BitwardenPSDownloads]][BitwardenPSGallery] ![BitwardenPSBuild] +[![Downloads]][Gallery] ![Build] ![Publish] + + +[Downloads]: https://img.shields.io/powershellgallery/dt/BitwardenPS +[Gallery]: https://www.powershellgallery.com/packages/BitwardenPS/ +[Build]: https://img.shields.io/github/actions/workflow/status/johnduprey/BitwardenPS/psscriptanalyzer.yml?branch=main&label=PSScriptAnalyzer +[Publish]: https://github.com/johnduprey/BitwardenPS/actions/workflows/publish.yml/badge.svg This module interacts with the Bitwarden Public API and the Vault API. @@ -87,7 +93,3 @@ text : @{text=Super secret text; hidden=False} This module is a work in progress. Pull requests are welcome. - -[BitwardenPSDownloads]: https://img.shields.io/powershellgallery/dt/BitwardenPS -[BitwardenPSGallery]: https://www.powershellgallery.com/packages/BitwardenPS/ -[BitwardenPSBuild]: https://img.shields.io/github/workflow/status/johnduprey/BitwardenPS/Check%20and%20Publish/main \ No newline at end of file