-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild-changelog
executable file
·26 lines (23 loc) · 1.06 KB
/
build-changelog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env php
<?php
print "[Release History](https://github.com/OnlineBuddies/Modyllic/releases) for PHP module Modyllic\n\n";
// You can optionally pass in a version and changelog file to load and
// prepend to the changelog. This is used to generate the changelog wiki
// prior to actually commiting anything.
if ( $argc==3 ) {
list($prog,$tag,$changelog_file) = $argv;
$changes = trim(file_get_contents($changelog_file));
print_version( $tag, date("Y-m-d"), $changes );
}
foreach (explode("\n",trim(`git for-each-ref --sort='-refname' --sort='-authordate' --format='%(refname:short) %(authordate:short)' refs/tags/v*.*.*`)) as $tag) {
list($tag_name,$tag_date) = explode(" ",$tag);
$changes = trim(`git show {$tag_name}:CHANGELOG 2> /dev/null`);
print_version( $tag_name, $tag_date, $changes );
}
function print_version($tag,$date,$changes) {
echo "[$tag](https://github.com/OnlineBuddies/Modyllic/releases/tag/$tag) $date\n\n";
if ( $changes == "" ) {
$changes = "* No changelog for this version.";
}
echo "$changes\n\n";
}