From 7a899c17e735bd63331afcd575c5cf971e00d024 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 21 Aug 2018 19:16:18 -0400 Subject: [ios, build] Improve jazzy readme generation - Include changelogs for all releases in the current semver minor series. - Use template for jazzy readme. --- platform/ios/docs/doc-README.md | 9 ------ platform/ios/scripts/deploy-packages.sh | 2 +- platform/ios/scripts/document.sh | 11 ++++--- platform/ios/scripts/release-notes-github.md.ejs | 12 ++++++++ platform/ios/scripts/release-notes-jazzy.md.ejs | 20 ++++++++++++ platform/ios/scripts/release-notes.js | 39 ++++++++++++++++++++---- platform/ios/scripts/release-notes.md.ejs | 12 -------- 7 files changed, 72 insertions(+), 33 deletions(-) delete mode 100644 platform/ios/docs/doc-README.md create mode 100644 platform/ios/scripts/release-notes-github.md.ejs create mode 100644 platform/ios/scripts/release-notes-jazzy.md.ejs delete mode 100644 platform/ios/scripts/release-notes.md.ejs diff --git a/platform/ios/docs/doc-README.md b/platform/ios/docs/doc-README.md deleted file mode 100644 index 3a95aa96de..0000000000 --- a/platform/ios/docs/doc-README.md +++ /dev/null @@ -1,9 +0,0 @@ -# [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) - -The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. - -![Mapbox Maps SDK for iOS screenshots](img/screenshot.png) - -For setup information, check out the [Mapbox Maps SDK for iOS homepage](https://www.mapbox.com/ios-sdk/). For detailed usage instructions, read “[First steps with the Mapbox Maps SDK for iOS](https://www.mapbox.com/help/first-steps-ios-sdk/)” and consult the [online examples](https://www.mapbox.com/ios-sdk/examples/). A [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) is also available. - -If you have any questions, please see [our help page](https://www.mapbox.com/help/). We welcome your [bug reports, feature requests, and contributions](https://github.com/mapbox/mapbox-gl-native/issues/). diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh index 4197a26678..640e2f31bf 100755 --- a/platform/ios/scripts/deploy-packages.sh +++ b/platform/ios/scripts/deploy-packages.sh @@ -103,7 +103,7 @@ 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 ) + RELEASE_NOTES=$( ./platform/ios/scripts/release-notes.js github ) github-release release \ --tag "ios-v${PUBLISH_VERSION}" \ --name "ios-v${PUBLISH_VERSION}" \ diff --git a/platform/ios/scripts/document.sh b/platform/ios/scripts/document.sh index 407d5f9adf..d38e7707b2 100755 --- a/platform/ios/scripts/document.sh +++ b/platform/ios/scripts/document.sh @@ -28,11 +28,10 @@ RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^ios-v//' -e 's/-.*//' ) rm -rf /tmp/mbgl mkdir -p /tmp/mbgl/ + +echo "Generating readme and release notes" README=/tmp/mbgl/README.md -cp platform/ios/docs/doc-README.md "${README}" -# http://stackoverflow.com/a/4858011/4585461 -echo "## Changes in version ${RELEASE_VERSION}" >> "${README}" -sed -n -e '/^## /{' -e ':a' -e 'n' -e '/^## /q' -e 'p' -e 'ba' -e '}' platform/ios/CHANGELOG.md >> "${README}" +node platform/ios/scripts/release-notes.js jazzy >> "${README}" rm -rf ${OUTPUT} mkdir -p ${OUTPUT} @@ -40,6 +39,7 @@ mkdir -p ${OUTPUT} cp -r platform/darwin/docs/img "${OUTPUT}" cp -r platform/ios/docs/img "${OUTPUT}" +echo "Generating jazzy docs for ${SHORT_VERSION}…" DEFAULT_THEME="platform/darwin/docs/theme" THEME=${JAZZY_THEME:-$DEFAULT_THEME} @@ -53,6 +53,7 @@ jazzy \ --root-url https://www.mapbox.com/ios-sdk/api/${RELEASE_VERSION}/ \ --theme ${THEME} \ --output ${OUTPUT} + # https://github.com/realm/jazzy/issues/411 find ${OUTPUT} -name *.html -exec \ - perl -pi -e 's/BRANDLESS_DOCSET_TITLE/iOS SDK $1/, s/Mapbox\s+(Docs|Reference)/Mapbox iOS SDK $1/' {} \; + perl -pi -e 's/BRANDLESS_DOCSET_TITLE/iOS SDK $1/, s/Mapbox\s+(Docs|Reference)/Mapbox Maps SDK for iOS $1/' {} \; diff --git a/platform/ios/scripts/release-notes-github.md.ejs b/platform/ios/scripts/release-notes-github.md.ejs new file mode 100644 index 0000000000..91115225e9 --- /dev/null +++ b/platform/ios/scripts/release-notes-github.md.ejs @@ -0,0 +1,12 @@ +[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-%> + +<% if (isPrerelease) { %> +To install this prerelease via CocoaPods, point your Podfile to either of these URLs: + +* https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v<%-CURRENTVERSION%>/platform/ios/Mapbox-iOS-SDK.podspec +* https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v<%-CURRENTVERSION%>/platform/ios/Mapbox-iOS-SDK-symbols.podspec +<% } -%> + +Documentation is [available online](https://www.mapbox.com/ios-sdk/api/<%-CURRENTVERSION%>/) or as part of the download. diff --git a/platform/ios/scripts/release-notes-jazzy.md.ejs b/platform/ios/scripts/release-notes-jazzy.md.ejs new file mode 100644 index 0000000000..9df41e85a6 --- /dev/null +++ b/platform/ios/scripts/release-notes-jazzy.md.ejs @@ -0,0 +1,20 @@ +# [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) + +The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. + +![Mapbox Maps SDK for iOS screenshots](img/screenshot.png) + +For setup information, check out the [Mapbox Maps SDK for iOS homepage](https://www.mapbox.com/ios-sdk/). For detailed usage instructions, read “[First steps with the Mapbox Maps SDK for iOS](https://www.mapbox.com/help/first-steps-ios-sdk/)” and consult the [online examples](https://www.mapbox.com/ios-sdk/examples/). + +If you have any questions, please see [our help page](https://www.mapbox.com/help/). We welcome your [bug reports, feature requests, and contributions](https://github.com/mapbox/mapbox-gl-native/issues/). + +## Changes in version <%-CURRENTVERSION%> + +<%-CURRENTCHANGELOG-%> + +<% OTHERRELEASES.forEach(function(release) { %> +## <%-release.version%> +<%-release.changelog%> +<% }) -%> + +See the [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/ios-v<%-CURRENTVERSION%>/platform/ios/CHANGELOG.md) for previous releases. diff --git a/platform/ios/scripts/release-notes.js b/platform/ios/scripts/release-notes.js index 5b2e2fa8d2..dc2b296e21 100755 --- a/platform/ios/scripts/release-notes.js +++ b/platform/ios/scripts/release-notes.js @@ -8,6 +8,15 @@ const semver = require('semver'); const changelog = fs.readFileSync('platform/ios/CHANGELOG.md', 'utf8'); +let outputMode = {}; +switch(process.argv[2]) { + case "jazzy": + outputMode.isJazzy = true; break; + case "github": + default: + outputMode.isGitHub = true; +} + /* Find current and immediately previous releases by parsing git tags. */ @@ -55,11 +64,29 @@ const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForC /* Fill and print the release notes template. */ -const templatedReleaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes.md.ejs', 'utf8'), { - 'CURRENTVERSION': currentVersion, - 'PREVIOUSVERSION': previousVersion, - 'CHANGELOG': currentReleaseNotes.changelog, - 'isPrerelease': semver.prerelease(currentVersion) -}); +let templatedReleaseNotes; + +if (outputMode.isGitHub) { + templatedReleaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes-github.md.ejs', 'utf8'), { + 'CURRENTVERSION': currentVersion, + 'PREVIOUSVERSION': previousVersion, + 'CHANGELOG': currentReleaseNotes.changelog, + 'isPrerelease': semver.prerelease(currentVersion) + }); +} + +if (outputMode.isJazzy) { + const minorReleaseSeries = semver.major(currentVersion) + "." + semver.minor(currentVersion) + ".0"; + const range = ">=" + minorReleaseSeries + " <" + currentVersion; + const otherReleasesInSeries = _.filter(releaseNotes, function(release) { + return semver.satisfies(release.version, range); + }); + + templatedReleaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes-jazzy.md.ejs', 'utf8'), { + 'CURRENTVERSION': currentVersion, + 'CURRENTCHANGELOG': currentReleaseNotes.changelog, + 'OTHERRELEASES': otherReleasesInSeries + }); +} process.stdout.write(templatedReleaseNotes); diff --git a/platform/ios/scripts/release-notes.md.ejs b/platform/ios/scripts/release-notes.md.ejs deleted file mode 100644 index 91115225e9..0000000000 --- a/platform/ios/scripts/release-notes.md.ejs +++ /dev/null @@ -1,12 +0,0 @@ -[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-%> - -<% if (isPrerelease) { %> -To install this prerelease via CocoaPods, point your Podfile to either of these URLs: - -* https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v<%-CURRENTVERSION%>/platform/ios/Mapbox-iOS-SDK.podspec -* https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v<%-CURRENTVERSION%>/platform/ios/Mapbox-iOS-SDK-symbols.podspec -<% } -%> - -Documentation is [available online](https://www.mapbox.com/ios-sdk/api/<%-CURRENTVERSION%>/) or as part of the download. -- cgit v1.2.1