Add release automation script and Homebrew-aware update dispatch

This commit is contained in:
gitea committed 2026-09-20 16:54:16 +08:00
1 parent 31c499ae60
commit 0bfad43bc3
8 files changed
+581 -174

No files matched your search

+19 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { compareSemVer, getMirrorMode, isNewerVersion, matchAssetForPlatform } from "./update.js";
import { compareSemVer, getMirrorMode, isHomebrewInstall, isNewerVersion, matchAssetForPlatform } from "./update.js";
type Asset = { name: string; downloadUrl: string; size: number };
@@ -185,4 +185,22 @@ describe("update command bgSave and cache integration", () => {
rmSync(tempDir, { recursive: true, force: true });
}
});
describe("isHomebrewInstall", () => {
test("detects Homebrew Cellar paths on Apple Silicon and Intel macOS", () => {
expect(isHomebrewInstall("/opt/homebrew/Cellar/seal-use/0.10.33/bin/seal-use")).toBe(true);
expect(isHomebrewInstall("/usr/local/Cellar/seal-use/0.10.33/bin/seal-use")).toBe(true);
expect(isHomebrewInstall("/opt/homebrew/bin/seal-use")).toBe(true);
});
test("detects Homebrew Cellar paths on Linuxbrew", () => {
expect(isHomebrewInstall("/home/linuxbrew/.linuxbrew/Cellar/seal-use/0.10.33/bin/seal-use")).toBe(true);
});
test("returns false for non-Homebrew paths", () => {
expect(isHomebrewInstall("/usr/local/bin/seal-use")).toBe(false);
expect(isHomebrewInstall("/Users/alice/.local/bin/seal-use")).toBe(false);
expect(isHomebrewInstall("/tmp/seal-use")).toBe(false);
});
});
});