mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-31 02:18:08 +00:00
fix(release): allow explicit non-publish changelog packing
This commit is contained in:
parent
585914fcd5
commit
9e2aed2ece
2 changed files with 42 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ const requiredPreparedPathGroups = [
|
|||
];
|
||||
const requiredControlUiAssetPrefix = "dist/control-ui/assets/";
|
||||
const DEFAULT_PREPACK_COMMAND_TIMEOUT_MS = 30 * 60 * 1000;
|
||||
const ALLOW_UNRELEASED_CHANGELOG_ENV = "OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG";
|
||||
|
||||
type PreparedFileReader = {
|
||||
existsSync: typeof existsSync;
|
||||
|
|
@ -118,6 +119,19 @@ export function resolvePrepackCommandTimeoutMs(env: NodeJS.ProcessEnv = process.
|
|||
);
|
||||
}
|
||||
|
||||
export function resolvePrepackAllowUnreleasedChangelog(
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
): boolean {
|
||||
const raw = env[ALLOW_UNRELEASED_CHANGELOG_ENV]?.trim();
|
||||
if (raw === undefined || raw === "" || raw === "0" || raw === "false") {
|
||||
return false;
|
||||
}
|
||||
if (raw === "1" || raw === "true") {
|
||||
return true;
|
||||
}
|
||||
throw new Error(`invalid ${ALLOW_UNRELEASED_CHANGELOG_ENV}: ${raw}`);
|
||||
}
|
||||
|
||||
export function resolvePrepackCommandStdio(
|
||||
options: SpawnSyncOptions,
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
|
|
@ -209,7 +223,9 @@ async function main(): Promise<void> {
|
|||
ensurePreparedArtifacts();
|
||||
await writeDistInventory();
|
||||
runBuildSmoke();
|
||||
await preparePackageChangelog();
|
||||
await preparePackageChangelog(process.cwd(), {
|
||||
allowUnreleased: resolvePrepackAllowUnreleasedChangelog(),
|
||||
});
|
||||
}
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
||||
|
|
|
|||
|
|
@ -2,12 +2,37 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
collectPreparedPrepackErrors,
|
||||
resolvePrepackAllowUnreleasedChangelog,
|
||||
resolvePrepackBuildEnvironment,
|
||||
resolvePrepackCommandStdio,
|
||||
resolvePrepackCommandTimeoutMs,
|
||||
runPrepackCommand,
|
||||
} from "../scripts/openclaw-prepack.ts";
|
||||
|
||||
describe("resolvePrepackAllowUnreleasedChangelog", () => {
|
||||
it("requires an explicit non-publish opt-in", () => {
|
||||
for (const raw of [undefined, "", "0", "false"]) {
|
||||
expect(
|
||||
resolvePrepackAllowUnreleasedChangelog({
|
||||
OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG: raw,
|
||||
}),
|
||||
).toBe(false);
|
||||
}
|
||||
for (const raw of ["1", "true"]) {
|
||||
expect(
|
||||
resolvePrepackAllowUnreleasedChangelog({
|
||||
OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG: raw,
|
||||
}),
|
||||
).toBe(true);
|
||||
}
|
||||
expect(() =>
|
||||
resolvePrepackAllowUnreleasedChangelog({
|
||||
OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG: "yes",
|
||||
}),
|
||||
).toThrow("invalid OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG: yes");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolvePrepackBuildEnvironment", () => {
|
||||
it("pins one timestamp across package and Control UI builds", () => {
|
||||
const commit = "0123456789abcdef0123456789abcdef01234567";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue