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

-PversionIncrementer=incrementerPatch not working

Open manideepla opened this issue 1 year ago • 2 comments

./gradlew --stacktrace release -Prelease.forceVersion=0.1.0 -Prelease.versionIncrementer=incrementPatch -Prelease.disableChecks -Prelease.pushTagsOnly

I'm using this command in a CI/CD pipeline on a repo that already has tags.

But the output is saying this:

> Task :release FAILED
Replacing pattern "version: 0.1.0" with "version: 0.1.0" in /azp/_work/1/s/README.md
Creating tag: basket-online-0.1.0

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':release'.
> org.eclipse.jgit.api.errors.RefAlreadyExistsException: tag 'Tag={
  object 836e8d53f9cd0a9a11070f82d238145d658f3c83
  type commit
  tag basket-online-0.1.0
  tagger PersonIdent[root, root@azdevops-scaledjob-wnw2s-tkds8, Tue May 28 14:30:24 2024 +0000]
  
  }' already exists

build.gradle configuration:

scmVersion {
    ignoreUncommittedChanges = false
    versionIncrementer 'incrementMinor'

    tag {
        prefix = 'basket-online'
        versionSeparator = '-'
    }
    nextVersion {
        suffix = 'SNAPSHOT'
        separator = '-'
    }

    hooks {
        //Not yet working
        pre 'fileUpdate', [file: 'README.md', pattern: { v, c -> /version: $v/ }, replacement: { v, c -> "version: $v" }]
        pre 'commit'
    }
}

Version is 1.13.6. Can you help please?

manideepla avatar May 28 '24 16:05 manideepla

The same seems to be working for the markNextVersion command though

./gradlew -Prelease.forceVersion=0.1.0 -Prelease.incrementer=incrementPatch -Prelease.localOnly --stacktrace markNextVersion

Output

> Task :markNextVersion
Creating next version marker tag: basket-online-0.1.1-SNAPSHOT
Changes made to local repository only

manideepla avatar May 28 '24 16:05 manideepla

One more observation is that the plugin seems to be printing 0.1.0 for gradlew currentVersion only when the latest commit does not have an associated tag. If the latest commit has a tag associated with it, it seems to be printing the version correctly.

manideepla avatar May 29 '24 07:05 manideepla