From 43ef4fa9a316579140428cf1d5f42ea996666151 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 2 Jun 2025 00:04:38 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20environm?= =?UTF-8?q?ent=20initialization=20step=20from=20Action-Test=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index afa6647..26c698d 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -24,9 +24,6 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Initialize environment - uses: PSModule/Initialize-PSModule@main - - name: Action-Test uses: ./ env: From cfdde31da73f4d4c742cd3b936a4ffc2cb6dd8a8 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 2 Jun 2025 00:05:37 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20unnecess?= =?UTF-8?q?ary=20module=20requirements=20from=20Publish-PSModule=20functio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/helpers/Publish-PSModule.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/helpers/Publish-PSModule.ps1 b/scripts/helpers/Publish-PSModule.ps1 index 96ce20d..fad9e1e 100644 --- a/scripts/helpers/Publish-PSModule.ps1 +++ b/scripts/helpers/Publish-PSModule.ps1 @@ -11,7 +11,6 @@ #> [OutputType([void])] [CmdletBinding()] - #Requires -Modules Utilities, PowerShellGet, Microsoft.PowerShell.PSResourceGet, GitHub, PSSemVer [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' From 74c26dc20df205071a0b3146faff3c7d9c3efaf6 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 2 Jun 2025 00:11:25 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20conditio?= =?UTF-8?q?n=20checks=20for=20version=20strings=20in=20Publish-PSModule=20?= =?UTF-8?q?script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.yml | 2 +- scripts/helpers/Publish-PSModule.ps1 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 2b0fac0..325bebc 100644 --- a/action.yml +++ b/action.yml @@ -80,7 +80,7 @@ runs: using: composite steps: - name: Install-PSModuleHelpers - uses: PSModule/Install-PSModuleHelpers@v1 + uses: PSModule/Install-PSModuleHelpers@removeInit - name: Run Publish-PSModule uses: PSModule/GitHub-Script@v1 diff --git a/scripts/helpers/Publish-PSModule.ps1 b/scripts/helpers/Publish-PSModule.ps1 index fad9e1e..ac26378 100644 --- a/scripts/helpers/Publish-PSModule.ps1 +++ b/scripts/helpers/Publish-PSModule.ps1 @@ -145,7 +145,7 @@ $latestRelease = $releases | Where-Object { $_.isLatest -eq $true } $latestRelease | Format-List | Out-String $ghReleaseVersionString = $latestRelease.tagName - if ($ghReleaseVersionString | IsNotNullOrEmpty) { + if (-not [string]::IsNullOrEmpty($ghReleaseVersionString)) { $ghReleaseVersion = New-PSSemVer -Version $ghReleaseVersionString } else { Write-Warning 'Could not find the latest release version. Using ''0.0.0'' as the version.' @@ -197,7 +197,7 @@ try { $manifestVersion = New-PSSemVer -Version (Test-ModuleManifest $manifestFilePath -Verbose:$false).Version } catch { - if ($manifestVersion | IsNullOrEmpty) { + if ([string]::IsNullOrEmpty($manifestVersion)) { Write-Warning 'Could not find the module version in the manifest. Using ''0.0.0'' as the version.' $manifestVersion = New-PSSemVer -Version '0.0.0' } @@ -248,7 +248,7 @@ $newVersion.Prerelease = $prereleaseName Write-Output "Partial new version: [$newVersion]" - if ($datePrereleaseFormat | IsNotNullOrEmpty) { + if (-not [string]::IsNullOrEmpty($datePrereleaseFormat)) { Write-Output "Using date-based prerelease: [$datePrereleaseFormat]." $newVersion.Prerelease += "$(Get-Date -Format $datePrereleaseFormat)" Write-Output "Partial new version: [$newVersion]" From 00b8361fadd5bb02af84f2a215aaee5e4f4cd539 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 2 Jun 2025 00:18:52 +0200 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20retry=20log?= =?UTF-8?q?ic=20for=20installing=20PSSemVer=20in=20Publish-PSModule=20scri?= =?UTF-8?q?pt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/main.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/main.ps1 b/scripts/main.ps1 index b946e9c..e7fedc7 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -1,6 +1,22 @@ [CmdletBinding()] param() +$retryCount = 5 +$retryDelay = 10 +for ($i = 0; $i -lt $retryCount; $i++) { + try { + Install-PSResource -Name 'PSSemVer' -TrustRepository -Repository PSGallery + break + } catch { + Write-Warning "Installation of $($psResourceParams.Name) failed with error: $_" + if ($i -eq $retryCount - 1) { + throw + } + Write-Warning "Retrying in $retryDelay seconds..." + Start-Sleep -Seconds $retryDelay + } +} + $path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') LogGroup "Loading helper scripts from [$path]" { Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | ForEach-Object { From 491e2e14860f530077adcb64a045f08a5959eb25 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 2 Jun 2025 01:15:45 +0200 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Install-?= =?UTF-8?q?PSModuleHelpers=20action=20to=20use=20version=20v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 325bebc..2b0fac0 100644 --- a/action.yml +++ b/action.yml @@ -80,7 +80,7 @@ runs: using: composite steps: - name: Install-PSModuleHelpers - uses: PSModule/Install-PSModuleHelpers@removeInit + uses: PSModule/Install-PSModuleHelpers@v1 - name: Run Publish-PSModule uses: PSModule/GitHub-Script@v1