# Conflicts: # .fabrica/artifex/release.yaml # docs/ROADMAP.md # docs/release.md
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// The release's one download (docs/release.md): the source of the commit being released, as
|
||||
// target/release/ianitor-X.Y.Z-src.tar.gz (every file git tracks, under ianitor-X.Y.Z/)
|
||||
// Ianitor ships no binary: the server builds it with Nix (docs/fabrica.md part 3). The archive is
|
||||
// listed in the release's SHA256SUMS, signed by domi-release, so the source a version names can be
|
||||
// checked. `git archive` of one tree gives the same bytes every time.
|
||||
// node scripts/pack-source.mjs X.Y.Z
|
||||
// Exit codes: 0 written, 1 git failed, 2 usage.
|
||||
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdirSync, readdirSync, rmSync, statSync } from "node:fs";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const repo = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const version = process.argv[2];
|
||||
if (process.argv.length !== 3 || !/^\d+\.\d+\.\d+$/.test(version)) {
|
||||
console.error("usage: node scripts/pack-source.mjs X.Y.Z");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const out = join(repo, "target", "release");
|
||||
mkdirSync(out, { recursive: true });
|
||||
for (const n of readdirSync(out)) if (/^ianitor-.*-src\.tar\.gz$/.test(n)) rmSync(join(out, n), { force: true });
|
||||
|
||||
const file = join(out, `ianitor-${version}-src.tar.gz`);
|
||||
const git = spawnSync("git", ["archive", "--format=tar.gz", `--prefix=ianitor-${version}/`, "-o", file, "HEAD"], { cwd: repo, stdio: "inherit" });
|
||||
if (git.error || git.status !== 0) {
|
||||
console.error(`pack-source: git archive failed${git.error ? `: ${git.error.message}` : ` (exit ${git.status})`}`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`pack-source: ${file} (${statSync(file).size} bytes)`);
|
||||
Reference in New Issue
Block a user