axion-release-plugin
axion-release-plugin copied to clipboard
Force increment a release.
I have a use case for a multi project build where modules a,b,c and d have a dependency on module e (common module they import).
I can get modules a,b,c and d to release when there are changes to those modules but i also need it so that if module e changes then modules a,b,c and d are also released.
I need a mechanism to release modules a,b,c and d if module e changes, but i can't quite figure out how.
Would anyone be able to advise on how to achieve this functionality ?
Hey @TabraizChel , maybe this pull request is related to your issue https://github.com/allegro/axion-release-plugin/pull/326
Would you mind sharing your config / setup? I'm trying to get it working for my multi-module project as well, but it seems my there is no specific version created for my modules and all are using the same "global" version tag. For example, if I just do ./gradlew release all modules will have the same version tag
@mklueh hi sure:
add this in the root build.gradle. I use kotlin so have to do some wrapping. If you're using groovy you can just do tag{prefix = ...}
scmVersion {
tag (closureOf<pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig> {
prefix = "some-prefix-for-root"
versionSeparator = "-"
})
monorepos(closureOf<MonorepoConfig> {
projectDirs = project.subprojects.map { p -> p.name }
})
// remove this if you want to do actual releases
localOnly = true
}
project.version = scmVersion.version
and then in the subprojects block add:
apply(plugin = "pl.allegro.tech.build.axion-release")
version = scmVersion.version
scmVersion {
tag(closureOf<TagNameSerializationConfig> {
prefix = project.name.replace('-', '_')
versionSeparator = "-"
})
localOnly = true
}
This should give you a tag per subproject. Where the subproject tags use the subproject name as a prefix
@mklueh hi sure:
add this in the root build.gradle. I use kotlin so have to do some wrapping. If you're using groovy you can just do
tag{prefix = ...}scmVersion { tag (closureOf<pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig> { prefix = "some-prefix-for-root" versionSeparator = "-" }) monorepos(closureOf<MonorepoConfig> { projectDirs = project.subprojects.map { p -> p.name } }) // remove this if you want to do actual releases localOnly = true } project.version = scmVersion.versionand then in the subprojects block add:
apply(plugin = "pl.allegro.tech.build.axion-release") version = scmVersion.version scmVersion { tag(closureOf<TagNameSerializationConfig> { prefix = project.name.replace('-', '_') versionSeparator = "-" }) localOnly = true }This should give you a tag per subproject. Where the subproject tags use the subproject name as a prefix
Thank you very much! I did not know that the config is needed in the subprojects as well and it looked like only applying the plugin and assigning the version is required. Will check it later.
Just curious, what do you use the version in the root project for?
@TabraizChel amazing, it works :)
@TabraizChel just one question, why do you apply the version first in the child projects before declaring the scmVersion config?
@TabraizChel I'm at the point where I have the same requirement. I've found a plugin that allows to run tasks for affected modules, and it also is able to execute a task of one module, when it'S dependents have changed, but without running the actual task of the dependents.
In my case, this is required, because I have component modules and application modules, and I only want to release applications, but also detect changes of the components.
I've created an issue there. The idea was to just combine this project with the axion release plugin.
- changedProjectsTask will run axion release of submodules (in my case applications) of changed applications or those applications where its modules have changed
- changedProjectsTask will run build and release of those changed applications as well
This requires a small change that allows passing the gradle task you want to run via command line argument, then it should work.