saveourtool/kompiledb

Reckon 0.13.2 incorrectly infers the release (`final`) version if the `HEAD` revision is already tagged

0x6675636b796f75676974687562 opened this issue · 1 comments

PR #45 introduced version inference using the outdated version 0.13.2 of the ajoberstar/reckon Gradle plug-in. Version 0.13.2 is the last one compatible with Java 8.

Yet, the plug-in is unsuitable for performing a release by merely pushing a tag, using the release.yml workflow.

Scenario A

Consider the HEAD revision is not tagged, and one of the previous revisions has the v1.0.0 tag. In this case,

./gradlew --no-daemon --console=plain -q -Preckon.stage=final :properties 2>/dev/null | grep '^version:' | awk '{ print $2 }'

will correctly increment the version and return 1.0.1.

Scenario B

Consider the HEAD revision is already tagged v1.0.1. Now,

./gradlew --no-daemon --console=plain -q -Preckon.stage=final :properties 2>/dev/null | grep '^version:' | awk '{ print $2 }'

will increment this very version and return 1.0.2 instead of 1.0.1. This means that the tag should be only created by Reckon itself, on the server side, as a part of the release-and-publish workflow, in a single Gradle invocation (./gradlew -Preckon.scope=... -Preckon.stage=final publish reckonTagPush). Gradle targets should be built in this very order:

  1. publish
  2. reckonTagPush

This line from the documentation is outright wrong:

Normally if your HEAD is already tagged, that version is used as a rebuild. However, if your repo is dirty, it knows it's not a rebuild.

Further reading:

This is a known issue:

The solution is to pass the empty stage value when releasing: -Preckon.stage=.

See this comment for details.