fix: replace inherited updater provider in Gitea packages

This commit is contained in:
2026-10-25 17:41:43 +03:00
parent 674d4bd8c6
commit 2da091d6e9
5 changed files with 34 additions and 11 deletions
+9 -1
View File
@@ -35,6 +35,13 @@ export async function writeChecksums(directory, version) {
await fsp.writeFile(path.join(directory, "SHA256SUMS"), lines.join("\n") + "\n");
}
export async function verifyPackagedUpdater(directory) {
const config = yaml.load(await fsp.readFile(path.join(directory, "resources", "app-update.yml"), "utf8"));
assert.equal(config.provider, "generic", "packaged updater must use the Gitea generic provider");
assert.equal(config.url, UPDATE_URL, "packaged updater must use the public Gitea release feed");
assert(!config.owner && !config.repo, "packaged updater must not retain an upstream GitHub destination");
}
export async function verifyLocal(directory, version) {
const names = expectedLinuxAssets(version);
const inventory = new Map();
@@ -145,6 +152,7 @@ async function main() {
const [command, directory = "dist"] = process.argv.slice(2);
const { version } = JSON.parse(await fsp.readFile(path.join(ROOT, "package.json"), "utf8"));
if (command === "checksums") await writeChecksums(directory, version);
else if (command === "verify-package") await verifyPackagedUpdater(directory);
else if (command === "verify") console.log(JSON.stringify(await verifyLocal(directory, version), null, 2));
else if (command === "upload") await upload(directory, version);
else if (command === "verify-remote") {
@@ -153,7 +161,7 @@ async function main() {
assert(release, "draft not found");
await verifyRemote(release, inventory, authorization());
console.log(`Verified draft: ${release.html_url}`);
} else throw new Error("Usage: node scripts/gitea-release.mjs checksums|verify|upload|verify-remote [dist-directory]");
} else throw new Error("Usage: node scripts/gitea-release.mjs checksums|verify|upload|verify-remote [dist-directory], or verify-package [unpacked-app-directory]");
}
if (process.argv[1] && pathToFileURL(path.resolve(process.argv[1])).href === import.meta.url) {
main().catch((error) => { console.error(error.message); process.exitCode = 1; });