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

fix: correct versions with prereleases #495

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

reggi
Copy link
Contributor

@reggi reggi commented Dec 11, 2024

prereleases do not work in release-please, i'm seeing the inability to get a repo into or out of prerelease mode, (where the packages have tags in the versions ie. -pre-0 at the end).

  • I was unable to get a repo into prerelease using the latest version of release-please on my personal project reggi/packages.
  • And the npm/cli has been stuck in prerelease mode. It was able to get itself into prerelease because of the wrapper around release-please we have in this repo. (trail: npm/cli workflow, Strategy Turnery)

I do not believe release please has this options.prerelease ternary anymore here's the mapping of what versioning-strategy is uses.

And even if it did choose to use PrereleaseVersioningStrategy or DefaultVersioningStrategy neither of these strategies have the ability to leave a prerelease. Because they always add the current prereleaseType or prereleaseType from the config from the existing version. Neither of these classes even have access to the options.prerelease boolean.

I created a fork of release-please which would deprecate the need for this PR, https://github.com/reggi/release-please with the typescirpt / esm alternatives to the files included in this PR:

This is added as a new versioning-strategy semver. To note the property currently documented as versioning-strategy in the docs is not working, and is currently versioning. I opened a PR to fix the json schema for the config, but now we know it's a bug i'll leave that discussion open there.

So "versioning-strategy": "semver" would be ignored and you'd need "versioning": "semver", again not relevant to this PR but another quirk to note.

This PR replaces both strategies with a new SemverVersioningStrategy which is always used, and has prerelease-aware replacement for semver.inc

  • Given the existing functionality for semver.inc, when incrementing to preminor with 2.1.0-pre.1 it bumps the minor 2.2.0-pre.0 which is incorrect.
  • The inc function included in this pr takes 2.1.0-pre.1 and sees that patch is 0 and will assume a bump has already taken place because it's in prerelease, and will only increment the tag number (known in semver as identifierBase or n) to 2.1.0-pre.2.

We will most likely also have extended conversations about adding this new prerelease-aware functionality to semver.inc in some way so other projects such as release-please can properly implement prereleases.

wraithgar
wraithgar previously approved these changes Dec 11, 2024
@wraithgar wraithgar changed the title fix: prereleases fix(release-please): fix version changes surrounding prereleases Dec 11, 2024
@wraithgar wraithgar changed the title fix(release-please): fix version changes surrounding prereleases fix: correct versions with prereleases Dec 11, 2024
@wraithgar wraithgar merged commit 252092a into main Dec 11, 2024
20 checks passed
@wraithgar wraithgar deleted the reggi/fix-prereleases branch December 11, 2024 22:36
@github-actions github-actions bot mentioned this pull request Dec 11, 2024
wraithgar pushed a commit that referenced this pull request Dec 11, 2024
🤖 I have created a release *beep* *boop*
---


##
[4.23.6](v4.23.5...v4.23.6)
(2024-12-11)
### Bug Fixes
*
[`252092a`](252092a)
[#495](#495) correct versions
with prereleases (#495) (@reggi)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants