-
Notifications
You must be signed in to change notification settings - Fork 157
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
Rc incrementors #142
base: main
Are you sure you want to change the base?
Rc incrementors #142
Conversation
Similar approach could be also useful with beta versions. I wonder is it worth to extend it (probably in an another PR) to support parameterized incrementers (with prefix as a parameter like |
I wonder if we could use some Gradle magic here and extract the suffix from task name? What i mean is dynamic tasks like |
The suffix could be configured in the scmVersion configuration like other configuration, e.g. in the versionIncrementer section perhaps? Alternatively, a project property, "release.releaseCandidateSuffix" could be used. Then it can be set from the task as you said. Task rules can be written like so: tasks.addRule("Pattern: create<Major|Minor|Final><Suffix> \t- create a release candidate") { String taskName ->
if (taskName.startsWith("create")) {
logger.info "Adding $taskName"
def p = /create(Major|Minor|Final)(.*)/
def majorMinorFinal = taskName.replaceAll(p) { all, mm, s -> mm }
def suffix = taskName.replaceAll(p) { all, mm, s -> s }
task(taskName) {
group = 'Creating release candidates'
description = "Creates a ${majorMinorFinal} with suffix ${suffix}"
doFirst {
logger.lifecycle "Create ${majorMinorFinal} with suffix: ${suffix}"
project.ext["release.releaseCandidateSuffix"] = suffix
if (majorMinorFinal == 'Final') {
project.ext["release.versionIncrementer"] = 'createFinal'
project.ext["release.forceSnapshot"] = true
} else {
project.ext["release.versionIncrementer"] = "create${majorMinorFinal}RC"
}
}
}
}
} But I think it was much short to write the separate tasks createMajorRC, createMinorRC and createFinal. |
Could you give me a day or two to try other implementation? If i fail to find time/implement we will go with this pr. |
Of course, no hurries! |
I was just about to request this feature, when a noticed this PR. Great work :) Please, remember to update the docs when you decide how the tasks should look like. |
5bfb848
to
48ce606
Compare
Created predefined incrementers:
Also created "createFinal" to release a final version from a prerelease, but couldn't make it work without using "release.forceSnapshot". There is an ignored test for it. It can be used as follows though: