mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-25 01:35:31 +00:00
* chore(release): verify releases on isolated release branches and harden shipping High-traffic merges on main cancel more than half of main CI runs, so waiting on main CI repeatedly stalls releases. Releases also ran duplicate post-tag CI, lacked a release-branch Desktop Packages trigger, hit unretried Apple notarytool polling errors and a finalize-rollout directory bug on macOS retries, and relied on a non-idempotent npm publish chain and conflict-prone reconcile cherry-picks. This splits release execution into release:prep:* (reversible version commit without tagging, pushed once to release/** for isolated CI + Desktop Packages) and release:ship[:beta] (idempotent npm publishing with retry, propagation checks, automatic beta dist-tag sync on stable, and release/*-only tag push), adds conflict-free main reconciliation, and extends macOS xcrun retries to notarytool submit and wait. * fix(release): address review findings on Docker retries, tag push, and reconciliation Isolate manual Docker publish dispatches in their own non-cancelling concurrency group, verify HEAD matches origin/<release-branch> before release:ship publishes or tags (and remove one-shot combined scripts that bypassed release-branch checks), drop --refs from peeled annotated-tag lookups in push-current-release-tag.mjs, retry lockfile sync in reconcile-release.mjs when package-lock.json version lags package.json, and document cutting from pre-existing tags. * fix(release): preserve TTY OTP prompts in npm publish and keep newer beta changelogs Inherit TTY stdin/stdout for interactive npm publish and dist-tag add (plus --otp passthrough) while keeping stderr piped for retry classification, and keep newer beta or promoted stable changelog entries intact when an older beta tag is reconciled.
82 lines
2.2 KiB
JavaScript
82 lines
2.2 KiB
JavaScript
import { execFileSync } from "node:child_process";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { computeNextReleaseVersion } from "./release-version-utils.mjs";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const rootDir = path.resolve(__dirname, "..");
|
|
const rootPackagePath = path.join(rootDir, "package.json");
|
|
|
|
function usageAndExit(code = 1) {
|
|
process.stderr.write(`Usage: node scripts/set-release-version.mjs --mode <mode> [--print]\n`);
|
|
process.stderr.write(
|
|
"Modes: patch, minor, major, beta-patch, beta-minor, beta-major, beta-next, promote\n",
|
|
);
|
|
process.exit(code);
|
|
}
|
|
|
|
function parseArgs(argv) {
|
|
const args = {
|
|
mode: "",
|
|
print: false,
|
|
};
|
|
|
|
for (let index = 0; index < argv.length; index += 1) {
|
|
const arg = argv[index];
|
|
if (arg === "--mode") {
|
|
args.mode = argv[index + 1] ?? "";
|
|
index += 1;
|
|
continue;
|
|
}
|
|
if (arg === "--print") {
|
|
args.print = true;
|
|
continue;
|
|
}
|
|
if (arg === "--help" || arg === "-h") {
|
|
usageAndExit(0);
|
|
}
|
|
usageAndExit();
|
|
}
|
|
|
|
if (!args.mode) {
|
|
usageAndExit();
|
|
}
|
|
|
|
return args;
|
|
}
|
|
|
|
const args = parseArgs(process.argv.slice(2));
|
|
const rootPackage = JSON.parse(readFileSync(rootPackagePath, "utf8"));
|
|
const currentVersion = typeof rootPackage.version === "string" ? rootPackage.version.trim() : "";
|
|
|
|
if (!currentVersion) {
|
|
throw new Error('Root package.json must contain a valid "version".');
|
|
}
|
|
|
|
const nextVersion = computeNextReleaseVersion(currentVersion, args.mode);
|
|
|
|
if (args.print) {
|
|
process.stdout.write(`${nextVersion}\n`);
|
|
process.exit(0);
|
|
}
|
|
|
|
const dirty = execFileSync("git", ["status", "--porcelain"], {
|
|
cwd: rootDir,
|
|
encoding: "utf8",
|
|
}).trim();
|
|
if (dirty) {
|
|
throw new Error("Git working directory not clean. Commit or stash changes before bumping.");
|
|
}
|
|
|
|
// Keep tagging atomic at `release:push` so `release:prep:*` can push the
|
|
// release branch for CI verification without creating a local tag early.
|
|
execFileSync("npm", ["version", nextVersion, "--include-workspace-root", "--no-git-tag-version"], {
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
});
|
|
execFileSync("git", ["commit", "-m", `chore(release): cut ${nextVersion}`], {
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
});
|