mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(release): keep Android notes aligned
This commit is contained in:
@@ -216,7 +216,7 @@ export function extractChangelogSection(content: string, heading: string): strin
|
||||
}
|
||||
|
||||
export function renderAndroidReleaseNotes(
|
||||
version: ResolvedAndroidVersion,
|
||||
version: Pick<ResolvedAndroidVersion, "canonicalVersion">,
|
||||
changelogContent: string,
|
||||
): string {
|
||||
const candidateHeadings = [version.canonicalVersion, "Unreleased"];
|
||||
|
||||
@@ -5,11 +5,14 @@ import {
|
||||
canonicalAndroidVersionCode,
|
||||
normalizeAndroidVersionCode,
|
||||
normalizePinnedAndroidVersion,
|
||||
renderAndroidReleaseNotes,
|
||||
renderAndroidVersionProperties,
|
||||
} from "./lib/android-version.ts";
|
||||
import { parseReleaseVersion } from "./lib/npm-publish-plan.mjs";
|
||||
|
||||
const MACOS_INFO_PLIST = "apps/macos/Sources/OpenClaw/Resources/Info.plist";
|
||||
const ANDROID_CHANGELOG_FILE = "apps/android/CHANGELOG.md";
|
||||
const ANDROID_RELEASE_NOTES_FILE = "apps/android/fastlane/metadata/android/en-US/release_notes.txt";
|
||||
const ANDROID_VERSION_FILE = "apps/android/version.json";
|
||||
const ANDROID_VERSION_PROPERTIES_FILE = "apps/android/Config/Version.properties";
|
||||
|
||||
@@ -213,8 +216,12 @@ function planMacosInfoPlist(
|
||||
function planAndroidVersion(rootDir: string, baseVersion: string): ReleaseVersionChange[] {
|
||||
const versionPath = path.join(rootDir, ANDROID_VERSION_FILE);
|
||||
const propertiesPath = path.join(rootDir, ANDROID_VERSION_PROPERTIES_FILE);
|
||||
const changelogPath = path.join(rootDir, ANDROID_CHANGELOG_FILE);
|
||||
const releaseNotesPath = path.join(rootDir, ANDROID_RELEASE_NOTES_FILE);
|
||||
const versionContent = fs.readFileSync(versionPath, "utf8");
|
||||
const propertiesContent = fs.readFileSync(propertiesPath, "utf8");
|
||||
const changelogContent = fs.readFileSync(changelogPath, "utf8");
|
||||
const releaseNotesContent = fs.readFileSync(releaseNotesPath, "utf8");
|
||||
const manifest = JSON.parse(versionContent) as AndroidVersionManifest;
|
||||
const currentVersion =
|
||||
typeof manifest.version === "string" ? normalizePinnedAndroidVersion(manifest.version) : null;
|
||||
@@ -229,6 +236,10 @@ function planAndroidVersion(rootDir: string, baseVersion: string): ReleaseVersio
|
||||
canonicalVersion: baseVersion,
|
||||
versionCode,
|
||||
});
|
||||
const nextReleaseNotesContent = renderAndroidReleaseNotes(
|
||||
{ canonicalVersion: baseVersion },
|
||||
changelogContent,
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -241,6 +252,11 @@ function planAndroidVersion(rootDir: string, baseVersion: string): ReleaseVersio
|
||||
nextContent: nextPropertiesContent,
|
||||
path: propertiesPath,
|
||||
},
|
||||
{
|
||||
currentContent: releaseNotesContent,
|
||||
nextContent: nextReleaseNotesContent,
|
||||
path: releaseNotesPath,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ function writeFixture(params?: {
|
||||
recursive: true,
|
||||
});
|
||||
fs.mkdirSync(path.join(root, "apps", "android", "Config"), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, "apps", "android", "fastlane", "metadata", "android", "en-US"), {
|
||||
recursive: true,
|
||||
});
|
||||
fs.writeFileSync(
|
||||
path.join(root, "package.json"),
|
||||
`${JSON.stringify(
|
||||
@@ -65,6 +68,34 @@ function writeFixture(params?: {
|
||||
)}\n`,
|
||||
);
|
||||
fs.writeFileSync(path.join(root, "apps", "android", "Config", "Version.properties"), "stale\n");
|
||||
fs.writeFileSync(
|
||||
path.join(root, "apps", "android", "CHANGELOG.md"),
|
||||
[
|
||||
"# Android Changelog",
|
||||
"",
|
||||
"## 2026.7.2",
|
||||
"",
|
||||
"- New release notes.",
|
||||
"",
|
||||
"## 2026.7.1",
|
||||
"",
|
||||
"- Previous release notes.",
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
fs.writeFileSync(
|
||||
path.join(
|
||||
root,
|
||||
"apps",
|
||||
"android",
|
||||
"fastlane",
|
||||
"metadata",
|
||||
"android",
|
||||
"en-US",
|
||||
"release_notes.txt",
|
||||
),
|
||||
"- Previous release notes.\n",
|
||||
);
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -129,6 +160,21 @@ describe("release version planning", () => {
|
||||
expect(
|
||||
fs.readFileSync(path.join(root, "apps", "android", "Config", "Version.properties"), "utf8"),
|
||||
).toContain("OPENCLAW_ANDROID_VERSION_CODE=2026070102");
|
||||
expect(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
root,
|
||||
"apps",
|
||||
"android",
|
||||
"fastlane",
|
||||
"metadata",
|
||||
"android",
|
||||
"en-US",
|
||||
"release_notes.txt",
|
||||
),
|
||||
"utf8",
|
||||
),
|
||||
).toBe("- Previous release notes.\n");
|
||||
});
|
||||
|
||||
it("starts a new Android train at its canonical build code", () => {
|
||||
@@ -144,6 +190,21 @@ describe("release version planning", () => {
|
||||
version: "2026.7.2",
|
||||
versionCode: 2026070201,
|
||||
});
|
||||
expect(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
root,
|
||||
"apps",
|
||||
"android",
|
||||
"fastlane",
|
||||
"metadata",
|
||||
"android",
|
||||
"en-US",
|
||||
"release_notes.txt",
|
||||
),
|
||||
"utf8",
|
||||
),
|
||||
).toBe("- New release notes.\n");
|
||||
});
|
||||
|
||||
it("validates every selected file before writing any changes", () => {
|
||||
|
||||
Reference in New Issue
Block a user