diff --git a/build.gradle b/build.gradle index ef1fa80..2f96e94 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,6 @@ +import org.ajoberstar.gradle.git.release.semver.* +import org.ajoberstar.gradle.git.release.opinion.Strategies + plugins { id 'java' id 'de.gliderpilot.semantic-release' version '1.2.0' @@ -23,6 +26,19 @@ artifacts { sourcesJar javadocJar } +release { + // add a second strategy to create release candidates from 'rc/.*' branches + versionStrategy semanticRelease.releaseStrategy.copyWith( + // the type is important, without type you would again replace the default strategy + type: 'rc', + selector: { SemVerStrategyState state -> + !state.repoDirty && state.currentBranch.name ==~ /rc\/.*/ && + semanticRelease.semanticStrategy.canRelease(state) && project.gradle.startParameter.taskNames.find { it == 'release' } + }, + preReleaseStrategy: StrategyUtil.all({ it.copyWith(inferredPreRelease: 'rc') } as PartialSemVerStrategy, Strategies.PreRelease.COUNT_INCREMENTED) + ) + +} semanticRelease { repo { ghToken = project.ext.ghToken