-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add script to resolve semver for WP_VERSION
env
#207
base: main
Are you sure you want to change the base?
Conversation
Seems like some bug with my logic. It should resolve the latest minor version. |
Co-authored-by: Pascal Birchler <[email protected]>
if ( 1 === $version_count ) { | ||
$constraint = "^$wp_version_env"; // Get the latest minor version. | ||
} elseif ( 2 === $version_count ) { | ||
$constraint = "~$wp_version_env.0"; // Get the latest patch version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added .0
as patch version due to semver package API behavior:
The ~ operator is best explained by example: ~1.2 is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0. Ref: https://getcomposer.org/doc/articles/versions.md#tilde-version-range-
Summary
This PR aims to add a script which helps to determine the semver for passed
WP_VERSION
env variable. To do so correctly, this script usescomposer/semver
package.Example cases:
Versions data
Fixes: #51