Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support/1.10 #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: Setup
uses: IntershopCommunicationsAG/.github/actions/[email protected]
- name: Build
uses: IntershopCommunicationsAG/.github/actions/[email protected]
uses: IntershopCommunicationsAG/.github/actions/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -284,45 +284,43 @@ class GitVersionService @JvmOverloads constructor(
private fun versionFromRelease(isContainer: Boolean) : String {
// version = 'branchname'-SNAPSHOT or increased version from tag ...
val vb = getLatestVersion()
val addMetaData = versionForLocalChanges("", "local")

return if (vb == defaultVersion) {
val branchName = getBranchNameForVersion(releasePrefix, branch)
val vrb = Version.forString(branchName, versionType)
val v = versionForLocalChanges("${vrb}", "${vrb}-local")
if(isContainer) { "${ v }-latest" } else { "${ v }-SNAPSHOT" }
var vrb = Version.forString(branchName, versionType)
setMetaData(vrb, isContainer, addMetaData).toString()
} else {
val addMetaData = versionForLocalChanges("", "local")
if (addMetaData.isNotBlank()) {
if(isContainer) {
vb.setBranchMetadata("${addMetaData}-latest").toString()
} else {
vb.setBranchMetadata("${addMetaData}-SNAPSHOT").toString()
}
} else {
vb.toString()
}
setMetaData(vb, isContainer, addMetaData).toString()
}
}

private fun versionFromSupport(isContainer: Boolean) : String {
// version = 'branchname'-SNAPSHOT or increased version from tag ...
val vb = getLatestVersion()
val addMetaData = versionForLocalChanges("", "local")

return if (vb == defaultVersion) {
val branchName = getBranchNameForVersion(supportPrefix, branch)
val vrb = Version.forString(branchName, versionType)
val v = versionForLocalChanges("${vrb}", "${vrb}-local")
if(isContainer) { "${ v }-latest" } else { "${ v }-SNAPSHOT" }
var vrb = Version.forString(branchName, versionType)
setMetaData(vrb, isContainer, addMetaData).toString()
} else {
val addMetaData = versionForLocalChanges("", "local")
if (addMetaData.isNotBlank()) {
if(isContainer) {
vb.setBranchMetadata("${addMetaData}-latest").toString()
} else {
vb.setBranchMetadata("${addMetaData}-SNAPSHOT").toString()
}
} else {
vb.toString()
}
setMetaData(vb, isContainer, addMetaData).toString()
}
}

private fun setMetaData(v: Version, isContainer: Boolean, branchMetaData: String): Version {
var rv = if (branchMetaData.isNotBlank()) {
v.setBranchMetadata(branchMetaData)
} else {
v
}
rv = if(isContainer) {
rv.setBuildMetadata("latest")
} else {
rv.setBuildMetadata("SNAPSHOT")
}
return rv
}

/**
Expand Down Expand Up @@ -358,6 +356,9 @@ class GitVersionService @JvmOverloads constructor(
branch.startsWith("${releasePrefix}${separator}") -> {
rv = versionFromRelease(false)
}
branch.startsWith("${supportPrefix}${separator}") -> {
rv = versionFromSupport( false)
}
else -> {
val branches = getBranchListForRef()
rv = when {
Expand Down Expand Up @@ -476,6 +477,7 @@ class GitVersionService @JvmOverloads constructor(
}
}
}

} else {
rv = "LOCAL"
}
Expand Down
Loading
Loading