Skip to content

Commit

Permalink
Merge pull request #21 from cocazoulou/master
Browse files Browse the repository at this point in the history
Adding support for Manual version bumping.
  • Loading branch information
PrzemyslawKlys authored Aug 17, 2023
2 parents 4378411 + 9ab3072 commit 30bd77d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Private/Step-Version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$CurrentVersion = [version] $ModuleGallery.Version
} catch {
#throw "Couldn't find module $Module to asses version information. Terminating."
$CurrentVersion = $null
$CurrentVersion = [version] $null
}
} else {
if (Test-Path -LiteralPath $LocalPSD1) {
Expand Down Expand Up @@ -84,25 +84,22 @@
break
}
}

if ($null -eq $CurrentVersion) {
$VersionToUpgrade = ''
$PreparedVersion.$StepType = 1
} else {
$VersionToUpgrade = $CurrentVersion.$StepType
$PreparedVersion.$StepType = $CurrentVersion.$StepType
}

if ($VersionToUpgrade -eq '') {
$ExpectedVersion = 1
} else {
$ExpectedVersion = $CurrentVersion.$StepType + 1
if([version] (($PreparedVersion.Values | Where-Object {$null -ne $_ }) -join '.') -gt $CurrentVersion) {
$PreparedVersion.$StepType = 0
}

$PreparedVersion.$StepType = $ExpectedVersion
$Numbers = foreach ($Key in $PreparedVersion.Keys) {
if ($PreparedVersion[$Key]) {
$PreparedVersion[$Key]
}
while ([version] (($PreparedVersion.Values | Where-Object {$null -ne $_ }) -join '.') -le $CurrentVersion) {
$PreparedVersion.$StepType = $PreparedVersion.$StepType + 1
}
$ProposedVersion = $Numbers -join '.'

$ProposedVersion = ([version] (($PreparedVersion.Values | Where-Object {$null -ne $_ }) -join '.')).ToString()

$FinalVersion = $null
$VersionCheck = [version]::TryParse($ProposedVersion, [ref] $FinalVersion)
Expand Down

0 comments on commit 30bd77d

Please sign in to comment.