axion-release-plugin icon indicating copy to clipboard operation
axion-release-plugin copied to clipboard

versionWithBranch version creator doesn't work with incrementPrerelease

Open grzegorzwitkowski opened this issue 6 years ago • 1 comments
trafficstars

Hi

I have a simple project with axion:

plugins {
    id 'java'
    id 'pl.allegro.tech.build.axion-release' version '1.10.1'
}

scmVersion {
    branchVersionCreator = [
            'rc/.*' : 'versionWithBranch'
    ]
    branchVersionIncrementer = [
        'rc/.*' : ['incrementPrerelease', [initialPreReleaseIfNotOnPrerelease: 'rc1']]
    ]
}

version = scmVersion.version

While being on rc/feature there is a mismatch between currentVersion and released version:

~/P/t/axion-test (rc/feature|✔) $ ./gradlew -q currentVersion

Project version: 0.1.1-rc1-rc-feature-SNAPSHOT
~/P/t/axion-test (rc/feature|✔) $ ./gradlew -q release -Prelease.disableChecks -Prelease.dryRun
Skipping uncommitted changes check
Skipping ahead of remote check
Skipping snapshot dependencies check
Creating tag: release-0.1.1-rc1
DRY-RUN: creating tag with name: release-0.1.1-rc1
Pushing all to remote: origin
DRY-RUN: pushing to remote: origin

So released version doesn't have branch suffix. It results in different tag and artefact version in Nexus.

grzegorzwitkowski avatar May 16 '19 11:05 grzegorzwitkowski

Hmm :D Okay, this is a corner case, but yeah, I see why it occurs - clash between branch name and rc- suffix. Because / in branch name gets sanitised and changed to rc-feature, which is later passed to incrementer. This might be quite easy to fix.

adamdubiel avatar May 21 '19 08:05 adamdubiel