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

Reduce frequency of version comment updates #4244

Merged
merged 1 commit into from
May 12, 2023

Conversation

frangio
Copy link
Contributor

@frangio frangio commented May 12, 2023

In #4243 we see that every file changed in 4.9.0-rc.0 is getting its version header bumped again to 4.9.0-rc.1 even though only one file is updated in rc.1.

The change in this PR is subtle but causes the effect we want.

When bumping from v4.9.0-rc.0 to v4.9.0-rc.1, it compares against the v4.9.0-rc.0 tag to figure out what files to update. When bumping from v4.9.0-rc.1 to v4.9.0, it compares against the v4.8.3 tag to figure out what files to update.

@frangio frangio requested review from Amxx and ernestognw May 12, 2023 00:07
@changeset-bot
Copy link

changeset-bot bot commented May 12, 2023

⚠️ No Changeset found

Latest commit: 6231f4b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -16,7 +16,7 @@ const { version } = require('../../package.json');
const [tag] = run('git', 'tag')
.split(/\r?\n/)
.filter(semver.coerce) // check version can be processed
.filter(v => semver.lt(semver.coerce(v), version)) // only consider older tags, ignore current prereleases
.filter(v => semver.satisfies(v, `< ${version}`)) // ignores prereleases unless currently a prerelease
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I was thinking you proposed semver.lt(v, version) instead.

Anyway, I think they're equivalent, in that case, how does this avoid that at the moment of releasing 5.0.0, we'll still have 4.9.0.rc-2?

Correct me if wrong, but I think that's solved if the semver.coerce in line 18 filters the 4.9.0,rc-1. But then, how is this not equivalent to the previous version (semver.lt(semver.coerce(v), version))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semver.coerce('v4.9.0-rc.0') returns '4.9.0', i.e. it removes the prerelease part. That's why I'm removing it in this PR.

The other important bit is that lt and satisfies + < behave differently...

  • lt: 4.8.3 < 4.9.0-rc.0 < 4.9.0-rc.1 < 4.9.0
  • satisfies: 4.8.3 < 4.9.0-rc.0 < 4.9.0-rc.1, but not 4.9.0-rc.1 < 4.9.0.

As a result, at the moment of releasing 4.9.0 we will ignore all the 4.9.0 prereleases and update the changed files since 4.8.3.

Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Lets keep in mind to check the the release code before pushing to npm

@frangio frangio merged commit 1642b66 into OpenZeppelin:master May 12, 2023
@frangio frangio deleted the reduce-version-bumps branch May 12, 2023 17:22
frangio added a commit that referenced this pull request May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants