diff --git a/scripts/release.mjs b/scripts/release.mjs index a58f150..02343ac 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -104,6 +104,29 @@ for (const p of [exePath, blockmapPath, latestYmlPath]) { } } +// --- Inject releaseNotes into latest.yml ---------------------------------- +// +// electron-builder doesn't write the CLI-supplied notes into the +// manifest by default — clients then see an empty body in the +// UpdateToast. Patch the YAML in place: append a block scalar +// (`releaseNotes: |-`) so multi-line content survives intact. +// Idempotent — skip if a `releaseNotes:` entry is already present +// (covers reruns / hand-edited manifests). +{ + let yml = readFileSync(latestYmlPath, 'utf8'); + if (!/^releaseNotes:/m.test(yml)) { + const indented = notes + .split('\n') + .map((l) => ' ' + l) + .join('\n'); + yml = yml.replace(/\s*$/, '') + `\nreleaseNotes: |-\n${indented}\n`; + writeFileSync(latestYmlPath, yml, 'utf8'); + console.log('Injected releaseNotes into latest.yml'); + } else { + console.log('latest.yml already has releaseNotes — skipping injection'); + } +} + // --- scp helpers ---------------------------------------------------------- const sshTarget = `${env.UPDATE_SSH_USER}@${env.UPDATE_HOST}`;