1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-07-17 04:21:16 +02:00
Files
json-machine/build/update-changelog.php
Filip Halaxa 91821315aa make cs-fix
2022-02-19 20:01:29 +01:00

24 lines
525 B
PHP

<?php
declare(strict_types=1);
$version = $argv[1];
$changelogPath = $argv[2];
$changelogContents = file_get_contents($changelogPath);
if (false !== strpos($changelogContents, $version)) {
echo "Version $version already in $changelogPath. Stopping.";
exit(1);
}
$releaseDate = date('Y-m-d');
$changelogMatch = '## master';
$changelogReplace = "$changelogMatch
Nothing yet
<br>
## $version - $releaseDate";
file_put_contents($changelogPath, str_replace($changelogMatch, $changelogReplace, $changelogContents));