diff options
author | Jason Wray <jason@mapbox.com> | 2018-08-21 19:16:18 -0400 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2018-08-21 19:28:07 -0400 |
commit | 7a899c17e735bd63331afcd575c5cf971e00d024 (patch) | |
tree | 6808d08fe3ca6271bb7d0aa201534c8795a35b57 | |
parent | 071a6d54719905f9e2bacf459a30ed629560e2ae (diff) | |
download | qtlocation-mapboxgl-upstream/fb-fix-ios-changelog-indentation.tar.gz |
[ios, build] Improve jazzy readme generationupstream/fb-fix-ios-changelog-indentation
- Include changelogs for all releases in the current semver minor series.
- Use template for jazzy readme.
-rwxr-xr-x | platform/ios/scripts/deploy-packages.sh | 2 | ||||
-rwxr-xr-x | platform/ios/scripts/document.sh | 11 | ||||
-rw-r--r-- | platform/ios/scripts/release-notes-github.md.ejs (renamed from platform/ios/scripts/release-notes.md.ejs) | 0 | ||||
-rw-r--r-- | platform/ios/scripts/release-notes-jazzy.md.ejs (renamed from platform/ios/docs/doc-README.md) | 13 | ||||
-rwxr-xr-x | platform/ios/scripts/release-notes.js | 39 |
5 files changed, 52 insertions, 13 deletions
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.md.ejs b/platform/ios/scripts/release-notes-github.md.ejs index 91115225e9..91115225e9 100644 --- a/platform/ios/scripts/release-notes.md.ejs +++ b/platform/ios/scripts/release-notes-github.md.ejs diff --git a/platform/ios/docs/doc-README.md b/platform/ios/scripts/release-notes-jazzy.md.ejs index 3a95aa96de..9df41e85a6 100644 --- a/platform/ios/docs/doc-README.md +++ b/platform/ios/scripts/release-notes-jazzy.md.ejs @@ -4,6 +4,17 @@ The Mapbox Maps SDK for iOS is an open-source framework for embedding interactiv ![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. +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); |