forked from verdigado/sunflower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-changelog.php
45 lines (32 loc) · 896 Bytes
/
create-changelog.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
$output = '<!DOCTYPE html>
<html lang="de-DE">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Changelog Sunflower Theme</title>
</head>
<body>
<h1>Changelogs</h1>';
exec('git tag', $tags);
$tags = array_reverse($tags);
for($i = 0; $i < count($tags); $i++){
$release = "";
$release .= sprintf("<h2>Neu in %s</h2>\n<ul>\n", $tags[$i]);
exec(sprintf('git log --pretty=format:"%%s" %s...%s', $tags[$i], $tags[$i+1]), $commits);
foreach($commits AS $commit){
if(preg_match('/^publishing|^Bump|^Merge /', $commit)){
continue;
}
$release .= sprintf("<li>%s</li>\n", $commit);
}
$release .= "</ul>\n\n";
$output .= $release;
if($tags[$i] == 'v1.0.0' ){
break;
}
}
$output .= '</body>
</html>
';
file_put_contents('changelog.html', $output);
echo "..done";