getMajor(), $currentVer->getMinor(), $currentVer->getPatch() + 1 )); function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev) : void{ $versionInfo = file_get_contents($versionInfoPath); $versionInfo = preg_replace( $pattern = '/^const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m', 'const BASE_VERSION = "' . $newVersion . '";', $versionInfo ); $versionInfo = preg_replace( '/^const IS_DEVELOPMENT_BUILD = (?:true|false);$/m', 'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false'). ';', $versionInfo ); file_put_contents($versionInfoPath, $versionInfo); } $versionInfoPath = dirname(__DIR__) . '/src/pocketmine/VersionInfo.php'; replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false); echo "please add appropriate notes to the changelog and press enter..."; fgets(STDIN); system('git add "' . dirname(__DIR__) . '/changelogs"'); system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"'); system('git tag ' . $currentVer->getBaseVersion()); replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true); system('git add "' . $versionInfoPath . '"'); system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"'); echo "pushing changes in 10 seconds\n"; sleep(10); system('git push origin HEAD ' . $currentVer->getBaseVersion());