summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rwxr-xr-xplatform/ios/scripts/deploy-packages.sh4
-rwxr-xr-xplatform/ios/scripts/release-notes.js37
-rw-r--r--platform/ios/scripts/release-notes.md.ejs10
4 files changed, 51 insertions, 1 deletions
diff --git a/package.json b/package.json
index 977cd2b09c..208d4e4c4a 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"pixelmatch": "^4.0.2",
"pngjs": "^3.0.0",
"request": "^2.72.0",
+ "semver": "^5.5.0",
"tape": "^4.5.1"
},
"engines": {
diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh
index 103e53768c..643475f680 100755
--- a/platform/ios/scripts/deploy-packages.sh
+++ b/platform/ios/scripts/deploy-packages.sh
@@ -102,10 +102,12 @@ if [[ "${GITHUB_RELEASE}" == true ]]; then
if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then
PUBLISH_PRE_FLAG='--pre-release'
fi
+ RELEASE_NOTES=$( ./platform/ios/scripts/release-notes.js )
github-release release \
--tag "ios-v${PUBLISH_VERSION}" \
--name "ios-v${PUBLISH_VERSION}" \
- --draft ${PUBLISH_PRE_FLAG}
+ --draft ${PUBLISH_PRE_FLAG} \
+ --description "${RELEASE_NOTES}"
fi
buildPackageStyle "ipackage" "symbols"
diff --git a/platform/ios/scripts/release-notes.js b/platform/ios/scripts/release-notes.js
new file mode 100755
index 0000000000..f47242d997
--- /dev/null
+++ b/platform/ios/scripts/release-notes.js
@@ -0,0 +1,37 @@
+#!/usr/bin/env node
+
+const fs = require('fs');
+const ejs = require('ejs');
+const _ = require('lodash');
+const semver = require('semver');
+
+const changelog = fs.readFileSync('platform/ios/CHANGELOG.md', 'utf8');
+
+// This regular expression parses the changelog for individual releases:
+// - Matches lines starting with "## ".
+// - Groups the version number.
+// - Skips the (optional) release date.
+// - Groups the changelog content.
+// - Ends when another "## " is found.
+const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## )/gms;
+
+let releases = [];
+while (match = regex.exec(changelog)) {
+ releases.push({
+ 'version': match[1],
+ 'changelog': match[2].trim(),
+ });
+}
+
+const currentRelease = releases[0];
+
+const versions = _.map(releases, 'version');
+const previousVersion = semver.maxSatisfying(versions, "<" + currentRelease.version);
+
+const releaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes.md.ejs', 'utf8'), {
+ 'currentVersion': currentRelease.version,
+ 'previousVersion': previousVersion,
+ 'changelog': currentRelease.changelog,
+});
+
+process.stdout.write(releaseNotes);
diff --git a/platform/ios/scripts/release-notes.md.ejs b/platform/ios/scripts/release-notes.md.ejs
new file mode 100644
index 0000000000..eedf9a0afa
--- /dev/null
+++ b/platform/ios/scripts/release-notes.md.ejs
@@ -0,0 +1,10 @@
+<%
+ const CURRENTVERSION = locals.currentVersion;
+ const PREVIOUSVERSION = locals.previousVersion;
+ const CHANGELOG = locals.changelog;
+-%>
+[Changes](https://github.com/mapbox/mapbox-gl-native/compare/ios-v<%-PREVIOUSVERSION%>...ios-v<%-CURRENTVERSION%>) since [Mapbox Maps SDK for iOS v<%-PREVIOUSVERSION%>](https://github.com/mapbox/mapbox-gl-native/releases/tag/ios-v<%-PREVIOUSVERSION%>):
+
+<%-CHANGELOG%>
+
+Documentation is [available online](https://www.mapbox.com/ios-sdk/api/<%-CURRENTVERSION%>/) or as part of the download.