pomander
pomander copied to clipboard
Deploying a tag based on a semver constrait
Being able to deploy a specific tag based on semantic versioning constraint similarly to Composer would be awesome. Along the lines of:
$env->version('3.2.*');
Where it then clones and checks out the latest tag from 3.2.x, e.g. tags/3.2.14.
PHP has few semver parsers that implements the full spec and allow constraints, making resolving pretty easy; run git tags
, $tags = explode("\n", $output)
and find the highest satisfying version from the array, along the lines of:
use vierbergenlars\SemVer\expression;
$expression = new expression($env->version);
$version = $expression->maxSatisfying($tags);
Then checkout the tag in the $version, e.g. git checkout tags/$version
.
I likey.
This would be helpful across the board for specifying any type of version whether it be the repository being deployed, or a dependency such as Wordpress or plugins, etc.