release: prepare v0.6.1 AppImage for new Gitea host

This commit is contained in:
2026-11-01 02:43:15 +03:00
parent 3377f4726b
commit a369bba4ec
7 changed files with 252 additions and 19 deletions
+7 -7
View File
@@ -13,7 +13,7 @@ import { pathToFileURL } from "node:url";
const require = createRequire(import.meta.url);
const yaml = require("js-yaml");
const ROOT = path.resolve(import.meta.dirname, "..");
export const SERVER = "https://server2.sorokin-oleg-edu.xyz";
export const SERVER = "https://git.sorokin-oleg-edu.xyz";
export const REPOSITORY = "replicated/learnharness";
export const UPDATE_URL = `${SERVER}/${REPOSITORY}/releases/download/latest`;
const API = `${SERVER}/api/v1/repos/${REPOSITORY}`;
@@ -125,8 +125,8 @@ export async function selectDraft(tag) {
}
return matches[0] ?? null;
}
async function upload(directory, version) {
const inventory = await verifyLocal(directory, version);
async function upload(directory, version, options = {}) {
const inventory = await verifyLocal(directory, version, options);
const tag = `v${version}`;
// The tag must already exist remotely; never create a release from a moving branch.
const tagged = await api(`/tags/${encodeURIComponent(tag)}`);
@@ -157,7 +157,7 @@ async function upload(directory, version) {
async function main() {
const [command, ...args] = process.argv.slice(2);
const appimageOnly = args.includes("--appimage-only");
assert(!appimageOnly || ["checksums", "verify"].includes(command), "--appimage-only is supported only by offline checksums and verify");
assert(!appimageOnly || ["checksums", "verify", "upload", "verify-remote"].includes(command), "--appimage-only is supported only by checksums, verify, upload and verify-remote");
assert(args.filter((arg) => arg === "--appimage-only").length <= 1, "duplicate --appimage-only option");
assert(args.every((arg) => !arg.startsWith("--") || arg === "--appimage-only"), "unknown release option");
const positional = args.filter((arg) => arg !== "--appimage-only");
@@ -167,14 +167,14 @@ async function main() {
if (command === "checksums") await writeChecksums(directory, version, { appimageOnly });
else if (command === "verify-package") await verifyPackagedUpdater(directory);
else if (command === "verify") console.log(JSON.stringify(await verifyLocal(directory, version, { appimageOnly }), null, 2));
else if (command === "upload") await upload(directory, version);
else if (command === "upload") await upload(directory, version, { appimageOnly });
else if (command === "verify-remote") {
const inventory = await verifyLocal(directory, version);
const inventory = await verifyLocal(directory, version, { appimageOnly });
const release = await selectDraft(`v${version}`);
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 [dist-directory] [--appimage-only], upload|verify-remote [dist-directory], or verify-package [unpacked-app-directory]");
} else throw new Error("Usage: node scripts/gitea-release.mjs checksums|verify|upload|verify-remote [dist-directory] [--appimage-only], 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; });