fix(release): guard appcast cleanup before notes path

This commit is contained in:
Vincent Koc 2026-06-20 19:28:42 +02:00
parent aea050b43e
commit abd5fb4494
No known key found for this signature in database
4 changed files with 28 additions and 1 deletions

View file

@ -39,9 +39,10 @@ if [[ -z "$VERSION" ]]; then
fi
TMP_DIR="$(mktemp -d)"
NOTES_HTML=""
cleanup() {
rm -rf "$TMP_DIR"
if [[ "${KEEP_SPARKLE_NOTES:-0}" != "1" ]]; then
if [[ -n "$NOTES_HTML" && "${KEEP_SPARKLE_NOTES:-0}" != "1" ]]; then
rm -f "$NOTES_HTML"
fi
}

View file

@ -737,6 +737,7 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
["scripts/ios-run.sh", ["test/scripts/ios-run.test.ts"]],
["scripts/create-dmg.sh", ["test/scripts/create-dmg.test.ts"]],
["scripts/kova-ci-summary.mjs", ["test/scripts/kova-ci-summary.test.ts"]],
["scripts/make_appcast.sh", ["test/scripts/make-appcast.test.ts"]],
["scripts/openclaw-npm-postpublish-verify.ts", ["test/openclaw-npm-postpublish-verify.test.ts"]],
["scripts/openclaw-npm-release-check.ts", ["test/openclaw-npm-release-check.test.ts"]],
["scripts/openclaw-prepack.ts", ["test/openclaw-prepack.test.ts"]],

View file

@ -0,0 +1,24 @@
// Make Appcast tests cover release appcast script behavior.
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const scriptPath = "scripts/make_appcast.sh";
describe("make_appcast cleanup", () => {
it("does not reference release notes before their path is assigned", () => {
const script = readFileSync(scriptPath, "utf8");
const setupBlock = script.slice(
script.indexOf('TMP_DIR="$(mktemp -d)"'),
script.indexOf('cp -f "$ZIP" "$TMP_DIR/$ZIP_NAME"'),
);
expect(setupBlock).toContain('NOTES_HTML=""');
expect(setupBlock.indexOf('NOTES_HTML=""')).toBeLessThan(
setupBlock.indexOf("trap cleanup EXIT"),
);
expect(setupBlock).toContain(
'if [[ -n "$NOTES_HTML" && "${KEEP_SPARKLE_NOTES:-0}" != "1" ]]; then',
);
expect(setupBlock).toContain('rm -f "$NOTES_HTML"');
});
});

View file

@ -1184,6 +1184,7 @@ describe("scripts/test-projects changed-target routing", () => {
],
["scripts/ios-run.sh", ["test/scripts/ios-run.test.ts"]],
["scripts/create-dmg.sh", ["test/scripts/create-dmg.test.ts"]],
["scripts/make_appcast.sh", ["test/scripts/make-appcast.test.ts"]],
["scripts/package-mac-app.sh", ["test/scripts/package-mac-app.test.ts"]],
["scripts/package-mac-dist.sh", ["test/scripts/package-mac-dist.test.ts"]],
["scripts/package-changelog.mjs", ["test/scripts/package-changelog.test.ts"]],