mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
Gate store releases on Seth's approval and include Firefox sources
This commit is contained in:
1 parent
a2b604a87a
commit
9fd51512e3
4 files changed
+198
-173
No files matched your search
@@ -12,24 +12,14 @@ function zipDirectory(sourceRel, outRel) {
|
||||
const sourceDir = join(root, sourceRel);
|
||||
const outZip = join(root, outRel);
|
||||
if (!existsSync(sourceDir)) throw new Error(`Missing build output: ${sourceRel}`);
|
||||
const manifest = JSON.parse(readFileSync(join(sourceDir, "manifest.json"), "utf8"));
|
||||
if (manifest.version !== version) throw new Error(`Rebuild ${sourceRel} for version ${version}`);
|
||||
|
||||
mkdirSync(dirname(outZip), { recursive: true });
|
||||
if (existsSync(outZip)) unlinkSync(outZip);
|
||||
|
||||
if (process.platform === "win32") {
|
||||
const esc = (s) => s.replace(/'/g, "''");
|
||||
execFileSync(
|
||||
"powershell",
|
||||
[
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
[
|
||||
"Add-Type -AssemblyName System.IO.Compression.FileSystem",
|
||||
`[IO.Compression.ZipFile]::CreateFromDirectory('${esc(sourceDir)}', '${esc(outZip)}')`,
|
||||
].join("; "),
|
||||
],
|
||||
{ stdio: "inherit" },
|
||||
);
|
||||
execFileSync("tar", ["-a", "-cf", outZip, "-C", sourceDir, "."], { stdio: "inherit" });
|
||||
} else {
|
||||
execFileSync("zip", ["-r", "-q", outZip, "."], { cwd: sourceDir, stdio: "inherit" });
|
||||
}
|
||||
@@ -47,10 +37,41 @@ const base =
|
||||
const chromeZip = `dist/${base}-chrome.zip`;
|
||||
const firefoxZip = `dist/${base}-firefox.zip`;
|
||||
|
||||
zipDirectory("dist/chrome", chromeZip);
|
||||
zipDirectory("dist/firefox", firefoxZip);
|
||||
console.log(`Packaged ${chromeZip}\nPackaged ${firefoxZip}`);
|
||||
if (!process.argv.includes("--sources-only")) {
|
||||
zipDirectory("dist/chrome", chromeZip);
|
||||
zipDirectory("dist/firefox", firefoxZip);
|
||||
console.log(`Packaged ${chromeZip}\nPackaged ${firefoxZip}`);
|
||||
}
|
||||
|
||||
const sourcesZip = `dist/${base}-sources.zip`;
|
||||
if (process.argv.includes("--sources") || process.argv.includes("--sources-only")) {
|
||||
// Archive the committed source only, never local credentials or dependency folders.
|
||||
execFileSync("git", ["diff", "--quiet", "HEAD", "--"], { cwd: root, stdio: "inherit" });
|
||||
mkdirSync(join(root, "dist"), { recursive: true });
|
||||
const instructions =
|
||||
`Build environment: ${process.platform} ${process.arch}, Node.js ${process.version}.\n` +
|
||||
"On Windows, run these commands in Git Bash:\n\n" +
|
||||
"npm ci\n" +
|
||||
"GH_RELEASE_UPDATE_CHECK=false UPDATE_CHANNEL=stable npm run build\n\n" +
|
||||
"Firefox output: dist/firefox. No .env file is required.\n";
|
||||
execFileSync(
|
||||
"git",
|
||||
[
|
||||
"archive",
|
||||
"--format=zip",
|
||||
"--output",
|
||||
join(root, sourcesZip),
|
||||
`--add-virtual-file=BUILD.txt:${instructions}`,
|
||||
"HEAD",
|
||||
],
|
||||
{ cwd: root, stdio: "inherit" },
|
||||
);
|
||||
console.log(`Packaged ${sourcesZip}`);
|
||||
}
|
||||
|
||||
if (process.env.GITHUB_OUTPUT) {
|
||||
appendFileSync(process.env.GITHUB_OUTPUT, `chrome_zip=${chromeZip}\nfirefox_zip=${firefoxZip}\n`);
|
||||
appendFileSync(
|
||||
process.env.GITHUB_OUTPUT,
|
||||
`chrome_zip=${chromeZip}\nfirefox_zip=${firefoxZip}\nsources_zip=${sourcesZip}\n`,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user