Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major version is not bumped on pre-release #272

Closed
bj00rn opened this issue Nov 26, 2024 · 6 comments
Closed

Major version is not bumped on pre-release #272

bj00rn opened this issue Nov 26, 2024 · 6 comments

Comments

@bj00rn
Copy link
Contributor

bj00rn commented Nov 26, 2024

Seems that pre release is not bumping major version correctly. Is this intended behaviour.

I would expect that a pre-release with a breaking change would bump version number. In this case release should be v6.0.0-rc.0 even though previous release was v5.1.1-rc.0.

Or is this intended behaviour?

extract from logs at https://github.com/bj00rn/ha-saleryd-ftx/actions/runs/12018170980/job/33502074725


Already up to date.
Recommended release type: major
Because: There is 1 BREAKING CHANGE and 0 features
Files to bump: custom_components/saleryd_hrv/manifest.json
Bumping version to file "custom_components/saleryd_hrv/manifest.json" with extension "json"
Bumped file "/home/runner/work/ha-saleryd-ftx/ha-saleryd-ftx/custom_components/saleryd_hrv/manifest.json" from "5.1.1-rc.0" to "5.1.1-rc.1"
Changelog generated
## [5.1.1-rc.1](https://github.com/bj00rn/ha-saleryd-ftx/compare/v5.1.1-rc.0...v5.1.1-rc.1) (2024-11-25)


### ⚠ BREAKING CHANGES

* Remove mode switches replaced by select. Remove state attributes

### Features

* major refactor ([a4f6662](https://github.com/bj00rn/ha-saleryd-ftx/commit/a4f6662c4a5de387f2f9ab3672b7f0dea20ef86e))


New version: 5.1.1-rc.1
/usr/bin/git add .
/usr/bin/git commit -m chore(release): v5.1.1-rc.1
[master 5154e96] chore(release): v5.1.1-rc.1
 2 files changed, 12 insertions(+), 9 deletions(-)
/usr/bin/git tag -a v5.1.1-rc.1 -m v5.1.1-rc.1
Push all changes
/usr/bin/git push origin master --follow-tags
To https://github.com/bj00rn/ha-saleryd-ftx.git
   e4bfff2..5[154](https://github.com/bj00rn/ha-saleryd-ftx/actions/runs/12018170980/job/33502074725#step:3:155)e96  master -> master
 * [new tag]         v5.1.1-rc.1 -> v5.1.1-rc.1
 
@TriPSs
Copy link
Owner

TriPSs commented Nov 26, 2024

Not 100% sure but I think the pre release always does -rc.x where x is one more then the previous. The semver package is used to do the actual bumping, you can check there for more info.

@bj00rn
Copy link
Contributor Author

bj00rn commented Nov 26, 2024

Not 100% sure but I think the pre release always does -rc.x where x is one more then the previous. The semver package is used to do the actual bumping, you can check there for more info.

Thanks, had a Quick Look at the docs and it seems you are correct. prerelease arg will bump only pre release version. I’m guessing pre[major|minor|patch] respectively need to be passed to semver to achieve what im after.

I think that would be a really nice feature if the action would take version bump type into consideration when bumping pre release

-i --increment [<level>]
        Increment a version by the specified level.  Level can
        be one of: major, minor, patch, premajor, preminor,
        prepatch, or prerelease.  Default level is 'patch'.
        Only one version may be specified.

@TriPSs
Copy link
Owner

TriPSs commented Nov 27, 2024

Now that i'm looking further in the code, I think we implemented prerelease incorrectly:

    newVersion = semver.inc(version, (prerelease ? 'prerelease' : releaseType), identifier)

We should send the prerelease value based off what releaseType is, so if releaseType is major (like in the logs you linked) we then need to send premajor indeed to semver.

Is this something you could create a PR + test for?

@bj00rn
Copy link
Contributor Author

bj00rn commented Nov 27, 2024

I don't think I have the bandwidth right now to get started on act etc i'm afraid.

Im guessing something in the ways of below, would suffice.

 newVersion = semver.inc(version, (prerelease ? `pre${releaseType}` : releaseType), identifier)

@bj00rn
Copy link
Contributor Author

bj00rn commented Nov 27, 2024

@TriPSs gave it a shot in #273. Probably should have some more tests with premajor, prepatch and subsequent stable release.

@TriPSs
Copy link
Owner

TriPSs commented Nov 28, 2024

@bj00rn thanks for the PR, it's released as v6

@TriPSs TriPSs closed this as completed Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants