allegro / allegro/axion-release-plugin

-Prelease.versionIncrementer does not work as expected

Open
#591 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
641
Forks
165
Avg merge
49m
Merged PRs (30d)
9

Description

Hi,

I am struggling a bit with the creation of pre-release version with axion on gitlab. The idea is to allow to create pre-release versions from branches and thus I added the following to my gitlab-ci.yml:

```yaml
release.candidate.minor:
extends: .gradle_job
stage: publish
only:
- branches
when: manual
script:
- git remote set-url origin ${CI_SERVER_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git
- ./gradlew release -Prelease.versionIncrementer=incrementPrerelease -Prelease.disableChecks -Prelease.pushTagsOnly -Prelease.overriddenBranchName=${CI_COMMIT_BRANCH} -Prelease.customUsername=${GRGIT_USER} -Prelease.customPassword=${GRGIT_PASS}

```
The `build.gradle.kts` file looks like the following:
```
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
`maven-publish`
id("pl.allegro.tech.build.axion-release") version "1.14.4"
}

repositories {
mavenCentral()
}

scmVersion {
versionIncrementer("incrementPrerelease", mapOf("initialPreReleaseIfNotOnPrerelease" to "rc1"))
}

group = "com.acme"
version = scmVersion.version

dependencies {
testImplementation(gradleTestKit())
testImplementation(platform("org.junit:junit-bom:5.9.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.2")
}

tasks.test {
useJUnitPlatform()
}
```
When I execute this gitlab task though, the job increments the patch version instead of adding a `-rc1` suffix to the version:

```
$ export GRADLE_USER_HOME=`pwd`/.gradle
$ git remote set-url origin ${CI_SERVER_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git
$ ./gradlew release -Prelease.versionIncrementer=incrementPrerelease -Prelease.disableChecks -Prelease.pushTagsOnly -Prelease.overriddenBranchName=${CI_COMMIT_BRANCH} -Prelease.customUsername=${GRGIT_USER} -Prelease.customPassword=${GRGIT_PASS}
Welcome to Gradle 7.6!
Here are the highlights of this release:
- Added support for Java 19.
- Introduced `--rerun` flag for individual task rerun.
- Improved dependency block for test suites to be strongly typed.
- Added a pluggable system for Java toolchains provisioning.
For more details see https://docs.gradle.org/7.6/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :verifyRelease
Skipping uncommitted changes check
Skipping ahead of remote check
Skipping snapshot dependencies check
> Task :release
Creating tag: v1.1.2
Pushing all to remote: origin
BUILD SUCCESSFUL in 12s
2 actionable tasks: 2 executed

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.