Skip to content

Commit 28aedd1

Browse files
🩹 [Patch]: Use PSSemVer function names (#24)
## Description - Use `PSSemVer` function names. ## 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 5f8d9bc commit 28aedd1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/helpers/Publish-PSModule.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ function Publish-PSModule {
153153
$latestRelease | Format-List
154154
$ghReleaseVersionString = $latestRelease.tagName
155155
if ($ghReleaseVersionString | IsNotNullOrEmpty) {
156-
$ghReleaseVersion = [PSSemVer]$ghReleaseVersionString
156+
$ghReleaseVersion = New-PSSemVer -Version $ghReleaseVersionString
157157
} else {
158158
Write-Warning 'Could not find the latest release version. Using ''0.0.0'' as the version.'
159-
$ghReleaseVersion = [PSSemVer]'0.0.0'
159+
$ghReleaseVersion = New-PSSemVer -Version '0.0.0'
160160
}
161161
Write-Verbose '-------------------------------------------------'
162162
Write-Verbose 'GitHub version:'
@@ -170,10 +170,10 @@ function Publish-PSModule {
170170
#region Get latest version - PSGallery
171171
Start-LogGroup 'Get latest version - PSGallery'
172172
try {
173-
$psGalleryVersion = [PSSemVer](Find-PSResource -Name $Name -Repository PSGallery -Verbose:$false).Version
173+
$psGalleryVersion = New-PSSemVer -Version (Find-PSResource -Name $Name -Repository PSGallery -Verbose:$false).Version
174174
} catch {
175175
Write-Warning 'Could not find module online. Using ''0.0.0'' as the version.'
176-
$psGalleryVersion = [PSSemVer]'0.0.0'
176+
$psGalleryVersion = New-PSSemVer -Version '0.0.0'
177177
}
178178
Write-Verbose '-------------------------------------------------'
179179
Write-Verbose 'PSGallery version:'
@@ -193,11 +193,11 @@ function Publish-PSModule {
193193
return
194194
}
195195
try {
196-
$manifestVersion = [PSSemVer](Test-ModuleManifest $manifestFilePath -Verbose:$false).Version
196+
$manifestVersion = New-PSSemVer -Version (Test-ModuleManifest $manifestFilePath -Verbose:$false).Version
197197
} catch {
198198
if ($manifestVersion | IsNullOrEmpty) {
199199
Write-Warning 'Could not find the module version in the manifest. Using ''0.0.0'' as the version.'
200-
$manifestVersion = [PSSemVer]'0.0.0'
200+
$manifestVersion = New-PSSemVer -Version '0.0.0'
201201
}
202202
}
203203
Write-Verbose '-------------------------------------------------'
@@ -213,7 +213,7 @@ function Publish-PSModule {
213213
Write-Verbose "GitHub: [$($ghReleaseVersion.ToString())]"
214214
Write-Verbose "PSGallery: [$($psGalleryVersion.ToString())]"
215215
Write-Verbose "Manifest: [$($manifestVersion.ToString())] (ignored)"
216-
$latestVersion = [PSSemVer]($psGalleryVersion, $ghReleaseVersion | Sort-Object -Descending | Select-Object -First 1)
216+
$latestVersion = New-PSSemVer -Version ($psGalleryVersion, $ghReleaseVersion | Sort-Object -Descending | Select-Object -First 1)
217217
Write-Verbose '-------------------------------------------------'
218218
Write-Verbose 'Latest version:'
219219
Write-Verbose ($latestVersion | Format-Table | Out-String)
@@ -226,7 +226,7 @@ function Publish-PSModule {
226226
Start-LogGroup 'Calculate new version'
227227

228228
# - Increment based on label on PR
229-
$newVersion = New-SemVer -Version $latestVersion
229+
$newVersion = New-PSSemVer -Version $latestVersion
230230
$newVersion.Prefix = $versionPrefix
231231
if ($majorRelease) {
232232
Write-Output 'Incrementing major version.'

0 commit comments

Comments
 (0)