Added support for macos release notes
This commit is contained in:
@@ -47,7 +47,7 @@ publish() {
|
||||
else
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${suffix}.zip
|
||||
fi
|
||||
step "Compressing ${file_name}…"
|
||||
step "Compressing ${file_name}-> ${pwd}../deploy/${file_name}"
|
||||
cd build/macos/pkg
|
||||
rm -f ../deploy/${file_name}
|
||||
zip -yr ../deploy/${file_name} *
|
||||
@@ -118,7 +118,7 @@ if [[ $( wget --spider -O- https://api.github.com/repos/${GITHUB_USER}/${GITHUB_
|
||||
fi
|
||||
|
||||
PUBLISH_VERSION=$( echo ${VERSION_TAG} | sed 's/^macos-v//' )
|
||||
#git checkout ${VERSION_TAG}
|
||||
git checkout ${VERSION_TAG}
|
||||
|
||||
step "Deploying version ${PUBLISH_VERSION}…"
|
||||
|
||||
@@ -129,15 +129,24 @@ fi
|
||||
npm install --ignore-scripts
|
||||
mkdir -p ${BINARY_DIRECTORY}
|
||||
|
||||
step "Generating release notes…"
|
||||
RELEASE_NOTES=$( ./platform/macos/scripts/release-notes.js github )
|
||||
|
||||
if [[ -z "${RELEASE_NOTES}" ]]; then
|
||||
echo "Release notes cannot be empty."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
step "Create GitHub release…"
|
||||
if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then
|
||||
PUBLISH_PRE_FLAG='--pre-release'
|
||||
fi
|
||||
# github-release release \
|
||||
# --tag "macos-v${PUBLISH_VERSION}" \
|
||||
# --name "macos-v${PUBLISH_VERSION}" \
|
||||
# --draft ${PUBLISH_PRE_FLAG}
|
||||
github-release release \
|
||||
--tag "macos-v${PUBLISH_VERSION}" \
|
||||
--name "macos-v${PUBLISH_VERSION}" \
|
||||
--description "${RELEASE_NOTES}" \
|
||||
--draft ${PUBLISH_PRE_FLAG}
|
||||
fi
|
||||
|
||||
publish -r xpackage -s symbols
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<%-CHANGELOG-%>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# [MapLibre Maps SDK for macos]
|
||||
|
||||
The MapLibre Maps SDK for macos 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.
|
||||
|
||||
## Changes in version <%-CURRENTVERSION%>
|
||||
|
||||
<%-CURRENTCHANGELOG%>
|
||||
|
||||
## Recent changes
|
||||
|
||||
<% OTHERRELEASES.forEach(function(release) { %>
|
||||
### <%-release.version%>
|
||||
|
||||
<%-release.changelog%>
|
||||
<% }) -%>
|
||||
103
platform/ios/platform/macos/scripts/release-notes.js
Executable file
103
platform/ios/platform/macos/scripts/release-notes.js
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const execSync = require('child_process').execSync;
|
||||
const ejs = require('ejs');
|
||||
const _ = require('lodash');
|
||||
const semver = require('semver');
|
||||
|
||||
const changelogPath = 'platform/macos/CHANGELOG.md';
|
||||
const changelog = fs.readFileSync(changelogPath, '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.
|
||||
*/
|
||||
let currentVersion = execSync('git describe --tags --match=macos-v*.*.* --abbrev=0')
|
||||
.toString()
|
||||
.trim()
|
||||
.replace('macos-v', '');
|
||||
|
||||
let gitTags = execSync('git tag --list macos-v*.*.*')
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(function (tag) {
|
||||
tag = tag.replace('macos-v', '').trim();
|
||||
return semver.clean(tag);
|
||||
});
|
||||
let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion);
|
||||
|
||||
/*
|
||||
Parse the raw changelog text and split it into individual releases.
|
||||
|
||||
This regular expression:
|
||||
- Matches lines starting with "## x.x.x".
|
||||
- Groups the version number.
|
||||
- Skips the (optional) release date.
|
||||
- Groups the changelog content.
|
||||
- Ends when another "## x.x.x" is found.
|
||||
*/
|
||||
const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
|
||||
|
||||
let releaseNotes = [];
|
||||
while (match = regex.exec(changelog)) {
|
||||
releaseNotes.push({
|
||||
'version': match[1],
|
||||
'changelog': match[2].trim(),
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
Match the current tag with the most appropriate release notes.
|
||||
*/
|
||||
const versionsInReleaseNotes = _.map(releaseNotes, 'version');
|
||||
const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion);
|
||||
const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion });
|
||||
|
||||
if (!currentReleaseNotes) {
|
||||
console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "master" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
Fill and print the release notes template.
|
||||
*/
|
||||
let templatedReleaseNotes;
|
||||
|
||||
if (outputMode.isGitHub) {
|
||||
templatedReleaseNotes = ejs.render(fs.readFileSync('platform/macos/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/macos/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