]> BookStack Code Mirror - devops/commitdiff
Added ny release changelog script, Updated translator script
authorDan Brown <redacted>
Mon, 3 Feb 2020 21:05:13 +0000 (21:05 +0000)
committerDan Brown <redacted>
Mon, 3 Feb 2020 21:05:13 +0000 (21:05 +0000)
meta-scripts/bookstack-changelog [new file with mode: 0755]
meta-scripts/bookstack-update-translators

diff --git a/meta-scripts/bookstack-changelog b/meta-scripts/bookstack-changelog
new file mode 100755 (executable)
index 0000000..4976ad7
--- /dev/null
@@ -0,0 +1,71 @@
+#!/usr/bin/php
+<?php
+
+function error($text) {
+       echo $text . "\n";
+       exit(1);
+}
+
+function output($text) {
+    echo $text . "\n";
+}
+
+function getJSON($url) {
+       $ch = curl_init();
+       curl_setopt_array($ch, [
+               CURLOPT_URL => $url,
+               CURLOPT_RETURNTRANSFER => 1,
+               CURLOPT_HTTPHEADER => [
+                       'User-Agent: ssddanbrown',
+               ]
+       ]);
+       $data = curl_exec($ch);
+
+       $err = curl_error($ch);
+       curl_close($ch);
+       if (!empty($err)) error($err);
+
+       return json_decode($data, true);
+}
+
+// Check a milestone is provided
+if (count($argv) < 2) {
+       error("Milestone ID required");
+}
+
+// Get milestone info from GitHub
+$milestoneID = intval($argv[1]);
+$issueURL = 'https://api.github.com/repos/BookStackApp/BookStack/issues?milestone='. $milestoneID .'&state=all';
+$issues = getJSON($issueURL);
+
+// Get BookStack version and check if a feature or minor release
+$milestone = $issues[0]['milestone'];
+$versionMatch = [];
+preg_match('/v[0-9.]{5,7}/', $milestone['title'], $versionMatch);
+$version = $versionMatch[0];
+$splitVersion = explode('.', $version);
+$isFeature = intval(array_pop($splitVersion)) === 0;
+
+// Output title
+output("# BookStack Beta {$version}\n");
+
+// Output header text and links
+if ($isFeature) {
+    $urlVersion = implode('0', $splitVersion);
+    output("- [Update instructions](https://www.bookstackapp.com/docs/admin/updates)");
+    output("- [Update details on blog](https://www.bookstackapp.com/blog/beta-release-{$urlVersion}/)");
+    output("\n### Full List of Changes\n");
+} else {
+    output("\nThis release contains the following fixes and changes:\n");
+}
+
+// Output issues
+foreach ($issues as $issue) {
+       $output = '* ';
+       $output .= trim($issue['title'], '.') . '.';
+       if (isset($issue['pull_request']) && $issue['user']['login'] !== 'ssddanbrown') {
+        $output .= " Thanks to [@{$issue['user']['login']}]({$issue['html_url']}).";
+    }
+       $output .= " ([#{$issue['number']}]({$issue['html_url']}))";
+    output($output);
+}
\ No newline at end of file
index 717b0cf4b95cba697d558f6291724546cc189330..d1761cf405db366c3d1ef1267e6d94542cbcbfa1 100755 (executable)
@@ -92,9 +92,16 @@ function makeMemberExportReport(string $key) {
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
 
     $result = curl_exec($ch);
+    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+    $error = curl_error($ch);
+    if ($error) {
+        throw new Exception($error);
+    }
+
     curl_close($ch);
 
     $data = json_decode($result);
+
     return $data;
 }