Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@semantic-release/git",
{
"assets": [
"gradle.properties"
"gradle.properties",
"charts/hedera-network-/Chart.yaml"
]
}
]
Expand Down
12 changes: 9 additions & 3 deletions buildSrc/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ class Utils {
}

@JvmStatic
fun updateCommitizenVersion(project: Project, newVersion: SemVer) {
val czFile = File(project.projectDir, ".cz.toml")
updateStringInFile(czFile, "version =", "version = \"${newVersion}\"")
fun updateHelmChartVersion(project: Project, chartName: String, newVersion: SemVer) {
val manifestFile = File(project.rootProject.projectDir, "charts/${chartName}/Chart.yaml")
updateStringInFile(manifestFile, "version:", "version: $newVersion")
}

@JvmStatic
fun updateHelmChartAppVersion(project: Project, chartName: String, newVersion: SemVer) {
val manifestFile = File(project.rootProject.projectDir, "charts/${chartName}/Chart.yaml")
updateStringInFile(manifestFile, "appVersion:", "appVersion: \"${newVersion}\"")
}

private fun updateStringInFile(file: File, startsWith: String, newString: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,25 @@ sonarqube {
tasks.register("githubVersionSummary") {
group = "versioning"
doLast {
val ghStepSummaryPath: String? = System.getenv("GITHUB_STEP_SUMMARY")
if (ghStepSummaryPath == null) {
throw IllegalArgumentException("This task may only be run in a Github Actions CI environment! Unable to locate the GITHUB_STEP_SUMMARY environment variable.")
}
val ghStepSummaryPath: String = System.getenv("GITHUB_STEP_SUMMARY")
?: throw IllegalArgumentException("This task may only be run in a Github Actions CI environment! Unable to locate the GITHUB_STEP_SUMMARY environment variable.")

val ghStepSummaryFile: File = File(ghStepSummaryPath)
Utils.generateProjectVersionReport(rootProject, BufferedOutputStream(ghStepSummaryFile.outputStream()))
}
}

val HEDERA_NETWORK_CHART = "hedera-network"

tasks.register("versionAsSpecified") {
group = "versioning"
doLast {
val verStr = findProperty("newVersion")?.toString()

if (verStr == null) {
throw IllegalArgumentException("No newVersion property provided! Please add the parameter -PnewVersion=<version> when running this task.")
}
?: throw IllegalArgumentException("No newVersion property provided! Please add the parameter -PnewVersion=<version> when running this task.")

val newVer = SemVer.parse(verStr)
Utils.updateCommitizenVersion(project, newVer)
Utils.updateHelmChartVersion(project, HEDERA_NETWORK_CHART, newVer)
Utils.updateHelmChartAppVersion(project, HEDERA_NETWORK_CHART, newVer)
Utils.updateVersion(project, newVer)
}
}
Expand All @@ -73,7 +71,8 @@ tasks.register("versionAsSnapshot") {
val currVer = SemVer.parse(project.version.toString())
val newVer = SemVer(currVer.major, currVer.minor, currVer.patch, "SNAPSHOT")

Utils.updateCommitizenVersion(project, newVer)
Utils.updateHelmChartVersion(project, HEDERA_NETWORK_CHART, newVer)
Utils.updateHelmChartAppVersion(project, HEDERA_NETWORK_CHART, newVer)
Utils.updateVersion(project, newVer)
}
}
Expand Down