updatecli icon indicating copy to clipboard operation
updatecli copied to clipboard

Feature Request: Allow to increment semver using rc

Open jvanz opened this issue 2 years ago • 6 comments

Is your feature request related to a problem?

When using transformers to increment a semver field, there is no transformer that allow bumping the release candidate suffix. For example, it's not possible to bump the version v1.0.0-rc1 to v1.0.0-rc2 using semver transformer.

Solution you'd like

Adds a new semver transformer allowing the release candidate version bumping.

Alternatives you've considered

No response

Anything else?

No response

jvanz avatar Mar 20 '23 18:03 jvanz

I think that could be trivial to add something like adding semver inc of type "rc" where the logic could be in https://github.com/updatecli/updatecli/blob/c2bfe049697b76bc7c652d181b71f8f3e0abc0bd/pkg/core/transformer/main.go#LL155C14-L155C16

with something like

  case "rc":
    if prerelease == regex(^rc(\d)$)
      // implement the logic

olblak avatar Mar 21 '23 09:03 olblak

I am wondering how to handle the following scenario

1.0.0-rc1 -> 1.0.0-rc2 -> -> 1.0.0-rc3 -> 1.0.0

olblak avatar Mar 21 '23 09:03 olblak

Just sharing a random idea... The semver tool consider 1.0.0-rc3 -> 1.0.0 a prerelease update.

$ semver diff v1.6.0-rc6 v1.6.0
prerelease

Therefore, we can have a flag just to say: "hey, this time is the final prerelease. Just remove the suffix". But I do not have a better idea so far.

jvanz avatar Apr 17 '23 17:04 jvanz

Maybe an easier solution is give the user the power to decide the release candidate suffix. The semver lib already have a function to allow that

jvanz avatar Apr 17 '23 17:04 jvanz

Why not, we would just need to add a case "prerelease" on https://github.com/updatecli/updatecli/blob/ba335eef7d154bb7806f2afdf0562807c0d33a3b/pkg/core/transformer/main.go#L155

I am still trying to visualise how to decide to increment to the next prerelease or removing the prelease information

olblak avatar Apr 18 '23 12:04 olblak

I am still trying to visualise how to decide to increment to the next prerelease or removing the prelease information

I think we can just give the user the power to set arbitrary string (validated by the semver lib) in the prerelease version. Something like:

- semverinc: 
      version: "major,minor"
      prerelease: "rc1"

Therefore, we do not need to increment the prerelease version. But we give the users the power to decide which version they want to set.

jvanz avatar Apr 18 '23 14:04 jvanz