sbt-version-policy icon indicating copy to clipboard operation
sbt-version-policy copied to clipboard

Shouldn't releaseVersion always be ReleaseVersion.fromCompatibility(BinaryAndSourceCompatible) for sbt-release?

Open steinybot opened this issue 10 months ago • 2 comments

sbt-release has the setNextVersion release step which is where we loosly decide what the next version should be. For example, releasing 1.0.0 will set the next version to 1.0.1-SNAPSHOT. version is always the next version to release (with a SNAPSHOT qualifier) which is a requirement for MiMa.

We run versionPolicyCheck in CI so any PR with breaking changes needs to: a) set versionPolicyIntention to something else such as BinaryCompatible b) and bump the version such as 1.1.0-SNAPSHOT

Now if we were to run release in this state then ReleaseVersion.fromCompatibility(versionPolicyIntention.value) is going to bump the minor again and we will end up releasing 1.2.0 instead of 1.1.0.

So shouldn't releaseStepTask(setAndCommitNextCompatibilityIntention) appear before setReleaseVersion?

steinybot avatar Apr 09 '24 00:04 steinybot

Hmm versionPolicyIntention seems to have double duties. When used in versionPolicyCheck it need to be BinaryCompatible to pass check on 1.1.0-SNAPSHOT. When used in ReleaseVersion.fromCompatibility it needs to be BinaryAndSourceCompatible to so that the release is 1.1.0.

So I guess the issue is not where releaseStepTask(setAndCommitNextCompatibilityIntention) occurs but rather releaseVersion should always be ReleaseVersion.fromCompatibility(BinaryAndSourceCompatible).

steinybot avatar Apr 09 '24 01:04 steinybot

b) and bump the version such as 1.1.0-SNAPSHOT

Is this really required? Would it be possible to keep the version 1.0.1-SNAPSHOT until the next release process? Thus, setReleaseVersion would use ReleaseVersion.fromCompatibility(versionPolicyIntention.value) and produce version 1.1.0 in your example.

Otherwise, if your workflow needs the version to be 1.1.0-SNAPSHOT, then I think you could even use the default releaseVersion (without using ReleaseVersion.fromCompatibility at all), no?

julienrf avatar Apr 11 '24 09:04 julienrf