@@ -13,31 +13,30 @@ version = run {
1313 val main = " 0.2.1"
1414
1515 val feat = run {
16- val releaseBuild = ! System .getenv(" CE_IS_RELEASING_FROM_THE_DEFAULT_BRANCH " ).isNullOrBlank()
17- val defaultBranch = System .getenv(" CE_IS_RELEASING_FROM_THE_DEFAULT_BRANCH " ) == " true "
16+ val releaseBuild = ! System .getenv(" BRANCH_KOOG_IS_RELEASING_FROM " ).isNullOrBlank()
17+ val branch = System .getenv(" BRANCH_KOOG_IS_RELEASING_FROM " )
1818 val customVersion = System .getenv(" CE_CUSTOM_VERSION" )
19+ val tcCounter = System .getenv(" TC_BUILD_COUNTER" )
1920
2021 if (releaseBuild) {
21- if (defaultBranch ) {
22+ if (branch == " main " ) {
2223 if (customVersion.isNullOrBlank()) {
2324 " "
2425 } else {
25- throw GradleException (" Custom version is not allowed during release from the default branch" )
26+ throw GradleException (" Custom version is not allowed during release from the main branch" )
2627 }
2728 } else {
2829 if (! customVersion.isNullOrBlank()) {
2930 " -feat-$customVersion "
31+ } else if (branch == " develop" && ! tcCounter.isNullOrBlank()) {
32+ " .$tcCounter "
3033 } else {
31- throw GradleException (" Custom version is required during release from the non-default branch" )
34+ throw GradleException (" Custom version is required during release from the non-main branch" )
3235 }
3336 }
3437 } else {
3538 // do not care
36- if (customVersion.isNullOrBlank()) {
37- " "
38- } else {
39- " -feat-$customVersion "
40- }
39+ " "
4140 }
4241 }
4342
@@ -115,12 +114,12 @@ tasks {
115114 doLast {
116115 val uriBase = " https://central.sonatype.com/api/v1/publisher/upload"
117116
118- val defaultBranch = System .getenv(" CE_IS_RELEASING_FROM_THE_DEFAULT_BRANCH " ) == " true "
119- val publishingType = if (defaultBranch ) {
120- println (" Publishing from the default branch, so publishing as AUTOMATIC." )
117+ val mainBranch = System .getenv(" BRANCH_KOOG_IS_RELEASING_FROM " ) == " main "
118+ val publishingType = if (mainBranch ) {
119+ println (" Publishing from the main branch, so publishing as AUTOMATIC." )
121120 " AUTOMATIC"
122121 } else {
123- println (" Publishing from the non-default branch, so publishing as USER_MANAGED." )
122+ println (" Publishing from the non-main branch, so publishing as USER_MANAGED." )
124123 " USER_MANAGED" // do not publish releases from non-main branches without approval
125124 }
126125
0 commit comments