Prepare for MapLibre Native Android 11.2.0 release (#2772)

This commit is contained in:
Bart Louwers
2024-08-27 17:35:19 +02:00
committed by GitHub
parent 1a308dde7d
commit 84bcf8cb5b
3 changed files with 48 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { simpleGit } from 'simple-git';
import { simpleGit } from "simple-git";
import * as fs from "node:fs";
/**
@@ -13,9 +13,13 @@ function usage() {
const platform = process.argv.at(2);
function getTagLastVersion() {
if (platform === "ios") {
const lastVersion = fs.readFileSync("platform/ios/CHANGELOG.md", "utf-8").split('\n').filter(line => line.startsWith('##'))[1].slice(3);
return `ios-v${lastVersion}`;
if (platform === "ios" || platform === "android") {
const lastVersion = fs
.readFileSync(`platform/${platform}/CHANGELOG.md`, "utf-8")
.split("\n")
.filter((line) => line.startsWith("## "))[1]
.slice(3);
return `${platform}-v${lastVersion}`;
}
usage();
}
@@ -25,22 +29,22 @@ const tagLastVersion = getTagLastVersion();
const git = simpleGit();
/**
*
* @param {string} tag
* @returns
*
* @param {string} tag
* @returns
*/
async function getCommit(tag) {
const result = await git.show(tag);
const match = result.match(/^commit\s([0-9a-f]{40})/m);
if (match) return match[1];
else throw new Error("Failed to find commit");
}
/**
*
* @param {string} message
* @returns
*
* @param {string} message
* @returns
*/
function formatMessageToMarkdownLink(message) {
// Regular expression to match the issue number pattern
@@ -49,10 +53,10 @@ function formatMessageToMarkdownLink(message) {
// Check if a match is found
if (match) {
const issueNumber = match[1];
const link = `https://github.com/maplibre/maplibre-native/pull/${issueNumber}`;
// Replace the issue number in the message with the Markdown link
return message.replace(regex, `[#${issueNumber}](${link})`);
const issueNumber = match[1];
const link = `https://github.com/maplibre/maplibre-native/pull/${issueNumber}`;
// Replace the issue number in the message with the Markdown link
return message.replace(regex, `[#${issueNumber}](${link})`);
}
// Return the original message if no issue number is found
@@ -61,7 +65,7 @@ function formatMessageToMarkdownLink(message) {
const commitLastVersion = await getCommit(tagLastVersion);
const logs = await git.log({from: commitLastVersion});
const logs = await git.log({ from: commitLastVersion });
for await (const logEntry of logs.all.toReversed()) {
console.log(`- ${formatMessageToMarkdownLink(logEntry.message)}.`);
}
}