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
16 changes: 11 additions & 5 deletions apps/review-desktop/scripts/validate-release-artifacts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ export function buildManifest({ version, commit, payloads, now = new Date() }) {
// Squirrel installs the zip's top-level folder under that name, so a zip whose
// folder does not match the bundle it is served to would rename the install.
export function assertZipFolder(zip, folder) {
const entries = execFileSync("unzip", ["-Z1", zip], { encoding: "utf8" })
.split("\n")
.filter(Boolean);

const roots = new Set(entries.map((entry) => entry.split("/")[0]));
// The full listing runs past execFileSync's default buffer, so reduce it
// to the distinct top-level names before it crosses the pipe.
const roots = new Set(
execFileSync(
"sh",
["-c", 'unzip -Z1 "$1" | cut -d/ -f1 | sort -u', "sh", zip],
{ encoding: "utf8" },
)
.split("\n")
.filter(Boolean),
);

if (roots.size !== 1 || !roots.has(folder)) {
throw new Error(
Expand Down
Loading