Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions scripts/prepare-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,16 @@ function updateChangelog(rootDir: string, version: string, section: string): voi
writeFileSync(changelogPath, content);
}

function updateReleasesReadme(rootDir: string, version: string, shortDescription: string): void {
function updateReleasesReadme(rootDir: string, version: string, shortDescription: string): boolean {
const readmePath = resolve(rootDir, "docs/releases/README.md");
let content = readFileSync(readmePath, "utf8");

// Find the table header separator line (| --- | --- | --- |)
const separatorRe = /^\|[ -]+\|[ -]+\|[ -]+\|$/m;
const match = content.match(separatorRe);
if (!match || match.index === undefined) {
fatal("Could not find the table in docs/releases/README.md");
// No release index table found — skip gracefully
return false;
}

const insertAfter = content.indexOf("\n", match.index);
Expand All @@ -369,6 +370,7 @@ function updateReleasesReadme(rootDir: string, version: string, shortDescription
content = content.slice(0, insertAfter + 1) + newRow + "\n" + content.slice(insertAfter + 1);

writeFileSync(readmePath, content);
return true;
}

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -613,13 +615,17 @@ async function main(): Promise<void> {
log("OK", "Updated: CHANGELOG.md");
}

// Update docs/releases/README.md
// Update docs/releases/README.md (if it has a release index table)
const shortDescription = summary.replace(/\.$/, "").slice(0, 60);
if (dryRun) {
log("--", "Would update: docs/releases/README.md");
log("--", "Would update: docs/releases/README.md (if table exists)");
} else {
updateReleasesReadme(rootDir, version, shortDescription);
log("OK", "Updated: docs/releases/README.md");
const updated = updateReleasesReadme(rootDir, version, shortDescription);
if (updated) {
log("OK", "Updated: docs/releases/README.md");
} else {
log("--", "No release index table in docs/releases/README.md (skipped).");
}
}
console.log("");

Expand Down Expand Up @@ -724,8 +730,12 @@ async function main(): Promise<void> {

if (!skipCommit && !dryRun) {
console.log(" Next steps:");
console.log(` 1. Monitor the desktop release workflow: ${REPO_URL}/actions/workflows/release.yml`);
console.log(` 2. Monitor the iOS TestFlight workflow: ${REPO_URL}/actions/workflows/release-ios.yml`);
console.log(
` 1. Monitor the desktop release workflow: ${REPO_URL}/actions/workflows/release.yml`,
);
console.log(
` 2. Monitor the iOS TestFlight workflow: ${REPO_URL}/actions/workflows/release-ios.yml`,
);
console.log(` 3. Verify the GitHub Release: ${REPO_URL}/releases/tag/${tag}`);
console.log(" 4. Test downloaded installers on each platform.");
console.log(" 5. Verify auto-update from the previous version.");
Expand Down
Loading