Skip to content

Commit caa0ab1

Browse files
🩹 [Patch]: Remove initialization step and dependency on Utilities (#50)
## Description Remove the initialization step and dependency on `Utilities`, the Install-PSModuleHelpers takes over. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 2da4e21 commit caa0ab1

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.github/workflows/Action-Test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
- name: Checkout repo
2525
uses: actions/checkout@v4
2626

27-
- name: Initialize environment
28-
uses: PSModule/Initialize-PSModule@main
29-
3027
- name: Action-Test
3128
uses: ./
3229
env:

scripts/helpers/Publish-PSModule.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#>
1212
[OutputType([void])]
1313
[CmdletBinding()]
14-
#Requires -Modules Utilities, PowerShellGet, Microsoft.PowerShell.PSResourceGet, GitHub, PSSemVer
1514
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
1615
'PSReviewUnusedParameter', '', Scope = 'Function',
1716
Justification = 'LogGroup - Scoping affects the variables line of sight.'
@@ -146,7 +145,7 @@
146145
$latestRelease = $releases | Where-Object { $_.isLatest -eq $true }
147146
$latestRelease | Format-List | Out-String
148147
$ghReleaseVersionString = $latestRelease.tagName
149-
if ($ghReleaseVersionString | IsNotNullOrEmpty) {
148+
if (-not [string]::IsNullOrEmpty($ghReleaseVersionString)) {
150149
$ghReleaseVersion = New-PSSemVer -Version $ghReleaseVersionString
151150
} else {
152151
Write-Warning 'Could not find the latest release version. Using ''0.0.0'' as the version.'
@@ -198,7 +197,7 @@
198197
try {
199198
$manifestVersion = New-PSSemVer -Version (Test-ModuleManifest $manifestFilePath -Verbose:$false).Version
200199
} catch {
201-
if ($manifestVersion | IsNullOrEmpty) {
200+
if ([string]::IsNullOrEmpty($manifestVersion)) {
202201
Write-Warning 'Could not find the module version in the manifest. Using ''0.0.0'' as the version.'
203202
$manifestVersion = New-PSSemVer -Version '0.0.0'
204203
}
@@ -249,7 +248,7 @@
249248
$newVersion.Prerelease = $prereleaseName
250249
Write-Output "Partial new version: [$newVersion]"
251250

252-
if ($datePrereleaseFormat | IsNotNullOrEmpty) {
251+
if (-not [string]::IsNullOrEmpty($datePrereleaseFormat)) {
253252
Write-Output "Using date-based prerelease: [$datePrereleaseFormat]."
254253
$newVersion.Prerelease += "$(Get-Date -Format $datePrereleaseFormat)"
255254
Write-Output "Partial new version: [$newVersion]"

scripts/main.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
[CmdletBinding()]
22
param()
33

4+
$retryCount = 5
5+
$retryDelay = 10
6+
for ($i = 0; $i -lt $retryCount; $i++) {
7+
try {
8+
Install-PSResource -Name 'PSSemVer' -TrustRepository -Repository PSGallery
9+
break
10+
} catch {
11+
Write-Warning "Installation of $($psResourceParams.Name) failed with error: $_"
12+
if ($i -eq $retryCount - 1) {
13+
throw
14+
}
15+
Write-Warning "Retrying in $retryDelay seconds..."
16+
Start-Sleep -Seconds $retryDelay
17+
}
18+
}
19+
420
$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers')
521
LogGroup "Loading helper scripts from [$path]" {
622
Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | ForEach-Object {

0 commit comments

Comments
 (0)