mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
build/make-release: improve support for non-stable release channels
This commit is contained in:
parent
616844696e
commit
93d844a281
@ -36,11 +36,13 @@ use function fwrite;
|
|||||||
use function getopt;
|
use function getopt;
|
||||||
use function is_string;
|
use function is_string;
|
||||||
use function max;
|
use function max;
|
||||||
|
use function preg_match;
|
||||||
use function preg_replace;
|
use function preg_replace;
|
||||||
use function sleep;
|
use function sleep;
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
use function str_pad;
|
use function str_pad;
|
||||||
use function strlen;
|
use function strlen;
|
||||||
|
use function strtolower;
|
||||||
use function system;
|
use function system;
|
||||||
use const STDERR;
|
use const STDERR;
|
||||||
use const STDIN;
|
use const STDIN;
|
||||||
@ -102,22 +104,43 @@ function main() : void{
|
|||||||
$filteredOpts[$optName] = $optValue;
|
$filteredOpts[$optName] = $optValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$channel = $filteredOpts["channel"] ?? null;
|
||||||
if(isset($filteredOpts["current"])){
|
if(isset($filteredOpts["current"])){
|
||||||
$currentVer = new VersionString($filteredOpts["current"]);
|
$currentVer = new VersionString($filteredOpts["current"]);
|
||||||
}else{
|
}else{
|
||||||
$currentVer = new VersionString(VersionInfo::BASE_VERSION);
|
$currentVer = new VersionString(VersionInfo::BASE_VERSION);
|
||||||
}
|
}
|
||||||
if(isset($filteredOpts["next"])){
|
|
||||||
$nextVer = new VersionString($filteredOpts["next"]);
|
$nextVer = isset($filteredOpts["next"]) ? new VersionString($filteredOpts["next"]) : null;
|
||||||
|
|
||||||
|
$suffix = $currentVer->getSuffix();
|
||||||
|
if($suffix !== ""){
|
||||||
|
if($channel === "stable"){
|
||||||
|
fwrite(STDERR, "error: cannot release a suffixed build into the stable channel\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if(preg_match('/^([A-Za-z]+)(\d+)$/', $suffix, $matches) !== 1){
|
||||||
|
echo "error: invalid current version suffix \"$suffix\"; aborting\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$nextVer ??= new VersionString(sprintf(
|
||||||
|
"%u.%u.%u-%s%u",
|
||||||
|
$currentVer->getMajor(),
|
||||||
|
$currentVer->getMinor(),
|
||||||
|
$currentVer->getPatch(),
|
||||||
|
$matches[1],
|
||||||
|
((int) $matches[2]) + 1
|
||||||
|
));
|
||||||
|
$channel ??= strtolower($matches[1]);
|
||||||
}else{
|
}else{
|
||||||
$nextVer = new VersionString(sprintf(
|
$nextVer ??= new VersionString(sprintf(
|
||||||
"%u.%u.%u",
|
"%u.%u.%u",
|
||||||
$currentVer->getMajor(),
|
$currentVer->getMajor(),
|
||||||
$currentVer->getMinor(),
|
$currentVer->getMinor(),
|
||||||
$currentVer->getPatch() + 1
|
$currentVer->getPatch() + 1
|
||||||
));
|
));
|
||||||
|
$channel ??= "stable";
|
||||||
}
|
}
|
||||||
$channel = $filteredOpts["channel"] ?? VersionInfo::BUILD_CHANNEL;
|
|
||||||
|
|
||||||
echo "About to tag version $currentVer. Next version will be $nextVer.\n";
|
echo "About to tag version $currentVer. Next version will be $nextVer.\n";
|
||||||
echo "$currentVer will be published on release channel \"$channel\".\n";
|
echo "$currentVer will be published on release channel \"$channel\".\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user