2024-12-02 00:36:27 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
$path = (function($path) {
|
|
|
|
if(!str_starts_with($path, '/'))
|
|
|
|
die('Cannot be bothered to support non-UNIX style paths, sorry!' . PHP_EOL);
|
|
|
|
|
|
|
|
while($path !== '/') {
|
|
|
|
$vPath = $path . DIRECTORY_SEPARATOR . 'VERSION';
|
|
|
|
if(is_file($vPath))
|
|
|
|
return $vPath;
|
|
|
|
|
|
|
|
$path = dirname($path);
|
|
|
|
}
|
|
|
|
})(__DIR__);
|
|
|
|
|
|
|
|
$version = file_get_contents($path);
|
|
|
|
if($version === false)
|
|
|
|
die('Failed to read VERSION file.' . PHP_EOL);
|
|
|
|
$version = trim($version);
|
|
|
|
|
|
|
|
$workingDir = getcwd();
|
|
|
|
try {
|
|
|
|
chdir(dirname($path));
|
|
|
|
echo shell_exec(sprintf('git tag %s', $version));
|
2024-12-02 00:37:46 +00:00
|
|
|
echo shell_exec(sprintf('git push origin %s', $version));
|
2024-12-02 00:36:27 +00:00
|
|
|
} finally {
|
|
|
|
chdir($workingDir);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $version . PHP_EOL;
|