[ios, build] Improve jazzy readme generation
- Include changelogs for all releases in the current semver minor series. - Use template for jazzy readme.
This commit is contained in:
@@ -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}" \
|
||||
|
||||
@@ -4,8 +4,12 @@ set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
if [ -z `which jazzy` ]; then
|
||||
echo "Installing jazzy…"
|
||||
step "Installing jazzy…"
|
||||
|
||||
CIRCLECI=${CIRCLECI:-false}
|
||||
if [[ "${CIRCLECI}" == true ]]; then
|
||||
@@ -28,11 +32,10 @@ RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^ios-v//' -e 's/-.*//' )
|
||||
|
||||
rm -rf /tmp/mbgl
|
||||
mkdir -p /tmp/mbgl/
|
||||
|
||||
step "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 +43,7 @@ mkdir -p ${OUTPUT}
|
||||
cp -r platform/darwin/docs/img "${OUTPUT}"
|
||||
cp -r platform/ios/docs/img "${OUTPUT}"
|
||||
|
||||
step "Generating jazzy docs for ${SHORT_VERSION}…"
|
||||
DEFAULT_THEME="platform/darwin/docs/theme"
|
||||
THEME=${JAZZY_THEME:-$DEFAULT_THEME}
|
||||
|
||||
@@ -53,6 +57,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/' {} \;
|
||||
|
||||
@@ -4,6 +4,20 @@ The Mapbox Maps SDK for iOS is an open-source framework for embedding interactiv
|
||||
|
||||

|
||||
|
||||
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%>
|
||||
|
||||
## Recent changes
|
||||
|
||||
<% 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.
|
||||
@@ -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,34 @@ 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);
|
||||
});
|
||||
|
||||
otherReleasesInSeries.forEach(function(release) {
|
||||
// Bump section headings from h3 to h4.
|
||||
release.changelog = release.changelog.replace(/^### /gm, '#### ');
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user