Repository navigation
Conversation
|
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1345 +/- ##
==========================================
+ Coverage 53.97% 54.73% +0.77%
==========================================
Files 29 29
Lines 2676 2717 +41
==========================================
+ Hits 1444 1487 +43
+ Misses 1232 1230 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
930792c to
a44bbc3
Compare
|
@orhun Is this PR of interest, or should I close it? |
a44bbc3 to
71f79fa
Compare
|
Hey, apologies for the delay. I'll get back to this soon :) |
There was a problem hiding this comment.
Thanks for opening this PR and working on this @anagno !
I’m currently neutral about supporting pre-releases in some form.
One thing that comes to mind, though, is that Semantic Versioning does not define any specific format or naming convention for pre-release identifiers (see https://semver.org/#spec-item-9). While alpha / beta / rc are commonly used, they are still just conventions and not part of the specification.
Because of that, supporting only these specific identifiers (as proposed in this PR) might be somewhat limiting and not fully generic. If we decide to move forward with accepting this feature, I'd personally prefer a more flexible approach that allows arbitrary pre-release identifiers rather than restricting it to a predefined set, although I'm not entirely sure how feasible that would be within the current implementation.
Just my first-glance feedback. Curious to hear if others have thoughts or alternative ideas from @anagno on how we might approach this.
Would extending the existing --bump option to support pre-releases achieve a similar result? 🤔
|
I tried to follow a similar logic to the approach used in the the commit-and-tag-version project Regarding generalization: we can extend the behavior, but we are still constrained by what the next_version crate supports, since that crate is responsible for computing the next version. I can make some more experiments, but I think it is feasible. Should it just accept any string and then pass it as parameter? The decision not to use the existing |
71f79fa to
ed5b62c
Compare
ed5b62c to
18c596f
Compare
|
I pushed a commit that generalizes the implementation. If no pre-release type is provided via the CLI, |
ognis1205
left a comment
There was a problem hiding this comment.
I tried to follow a similar logic to the approach used in the the commit-and-tag-version project
Thanks for explaining the rationale. That helps a lot. I understand the background and why you chose to follow that approach.
Regarding generalization: we can extend the behavior, but we are still constrained by what the next_version crate supports, since that crate is responsible for computing the next version. I can make some more experiments, but I think it is feasible. Should it just accept any string and then pass it as parameter?
next_version already supports prerelease increments, although the incrementing behavior is defined by its own rules. Since there isn't a strict specification governing prerelease value semantics or how they should be incremented, we would inevitably be choosing one interpretation anyway.
Given that, and to keep responsibilities clearly separated, I think it would be more consistent with git-cliff's existing design to rely on next_version for the increment logic instead of introducing custom handling.
The decision not to use the existing --bump flag was intentional. My thinking was that a user might want to request both a major-level bump and a pre-release at the same time. In that case, combining everything into a single flag felt limiting, so I introduced a separate flag for pre-releases.
This is probably the most debatable part of the change.
After reconsidering it, I agree that introducing a separate flag for prereleases can make sense if we want to support combinations like a major bump together with a prerelease. However, I still think the new flag should conceptually depend on --bump, rather than behave as a fully independent option.
For example, something along the lines of:
#[derive(Parser)]
struct Cli {
#[arg(long, value_enum)]
bump: Option<BumpOption>,
#[arg(long, required_if_eq("bump", "prerelease"))]
prerelease: Option<String>,
}As you mentioned, a user might want to request both a major level bump and a prerelease at the same time. Precisely because of that, the interaction between these flags becomes semantically significant and could easily shift user expectations around the existing --bump behavior.
Since this directly affects how version computation is interpreted, and potentially interferes with the current --bump semantics, I think it would be better to step back and discuss the intended specification and user-facing behavior in an issue first before finalizing the implementation.
|
@ognis1205 Should I create the issue or will you do it ? |
Could you create it? |
|
@ognis1205 @orhun I added a couple of UTs documenting what is happening with the |
14f2694 to
4871232
Compare
ecb7393 to
c2c3d6a
Compare
c2c3d6a to
de9e963
Compare
orhun
left a comment
There was a problem hiding this comment.
-
--releaseappears to be a no-op when used by itself.write_changelogcalculates a version only when--bumpor--bumped-versionis set, and--releasesets neither. Could you make --release trigger version calculation, or update the docs to show the required bump flag? -
Also, finalizing a prerelease is now the default for any bump without
--prerelease(1.2.0-rc.1->1.2.0). That makes--releaseunnecessary when a bump is requested. Could you clarify which behavior is intended and align the flag and docs with it? -
Lastly,
--releasesounds like a "release" action, maybe we can rename it tofinalize-releaseor sth shorter? WDYT?
Add the possibility of specifying pre-releases via the cli arguments. Now it is possible to specify in the cli `--pre-release [type]` and the bump version will be a prerelease Signed-off-by: Vasileios Anagnostopoulos <anagnwstopoulos@hotmail.com>
de9e963 to
1e34280
Compare
I tried to simplify it and I just removed the Is that better ? |
|
@orhun Any comments on the latest changes ? |
Add the possibility of specifying prereleases via the cli arguments. Now it is possible to specify in the cli
--prerelease [type]and the bump version will be a prereleaseDescription
Many projects have the need of creating pre-releases for testing with users, before the final release. This PR implements and extra cli argument that the user can specify the type of the prerelease and then changelogs for prereleases will be generated.
It makes sure that the calculation of the prerelease is correct. So if there already an
rcversion and the user specifies via the cli--pre-release alpha, then the calculcation will be correct and it will increment the rc versionThere was a similar issue in the past, but it was never planned. So if it is not of interests feel free just to close the PR.
To make it work with
ingore_tagsI had to refactor a bit theprocess_releasesfunction. Now it happens in 2 steps, so the calculation of the next version happens first, and then we filter out the releases that we do not want.Motivation and Context
Give the possibility of specifying prereleases, so that projects can create changelogs for these releases
How Has This Been Tested?
I included a couple of new UTs and tested it manually by invonking the git-cliff cli. For example:
Screenshots / Logs (if applicable)
Types of Changes
Checklist:
I have not yet gone through all the points ( and I have not yet update the docs, because I wanted first to get some feedback :) )