#!/usr/bin/env php

Version $version

\n\n\n"; if ($changelog) { $contents = ob_get_clean(); $log = file_get_contents($changelog); if (empty($log)) { fprintf(STDERR, "Unable to read $changelog\n"); exit(1); } $parts = explode('.', $version, 3); if (count($parts) < 2) { fprintf(STDERR, "Unable to parse branch from $version\n"); exit(1); } $tag = ""; if (strpos($log, $tag) === false) { fprintf(STDERR, "Unable to find branch tag in ChangeLog\n"); exit(1); } $log = str_replace($tag, "$tag\n\n$contents", $log); file_put_contents($changelog, $log); }