Skip to content

Commit

Permalink
fix computing the next version
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Aug 12, 2024
1 parent 370ab2b commit 4a5cc54
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ fun Version.nextMinor(): Version {
}

fun Version.next(): Version {
return if (preRelease != null) {
copy(preRelease = preRelease.copy(version = preRelease.version + 1), isSnapshot = false)
} else {
copy(patch = patch + 1, isSnapshot = false)
return when {
isSnapshot -> {
copy(isSnapshot = false)
}
preRelease != null -> {
copy(preRelease = preRelease.copy(version = preRelease.version + 1), isSnapshot = false)
}
else -> {
copy(patch = patch + 1, isSnapshot = false)
}
}
}

Expand Down

0 comments on commit 4a5cc54

Please sign in to comment.