From 83de7fbc6a4c05c862bb31b8d8bb4b970c2fdae9 Mon Sep 17 00:00:00 2001 From: lex00 Date: Tue, 17 Nov 2026 14:34:05 -0700 Subject: [PATCH] ci(release): chant 0.124.104, release doctor off in the cut job until chant runs it with the publish job's credentials --- .github/workflows/publish.yml | 1 - action/index.mjs | 237 ++++++++++++++++++++-------------- chant.config.ts | 2 +- package-lock.json | 8 +- package.json | 2 +- 5 files changed, 147 insertions(+), 103 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6ad1b2c..54cc7e2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,7 +60,6 @@ jobs: registry-url: https://registry.npmjs.org - run: npm ci - run: "have=\"$(npm --version)\"; if [ \"$(printf '%s\\n' \"11.5.1\" \"$have\" | sort -V | head -n1)\" != \"11.5.1\" ]; then npm install -g npm@11.19.0; fi; npm --version" - - run: npx chant release doctor - run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*' - run: rc=0; git ls-remote --exit-code --heads origin chant/lifecycle >/dev/null || rc=$?; if [ "$rc" = 0 ]; then git fetch origin chant/lifecycle:chant/lifecycle; elif [ "$rc" != 2 ]; then exit "$rc"; fi - run: | diff --git a/action/index.mjs b/action/index.mjs index 6bde9dd..33896ba 100644 --- a/action/index.mjs +++ b/action/index.mjs @@ -234946,18 +234946,30 @@ function chantPackageSourceTarget(specifier, parentPath) { dir = parent; } } -function ensureTypeScriptLoader() { +function ensureTypeScriptLoader(projectDir) { const state = compiledState(); if (!state) return false; if (state.tsx) return true; - const load4 = (specifier) => requireOptionalPeer("tsx", specifier, "run TypeScript", import.meta.url); + const from = tsxResolvedFrom(projectDir) ?? import.meta.url; + const load4 = (specifier) => requireOptionalPeer("tsx", specifier, "run TypeScript", from); load4("tsx/cjs/api").register(); load4("tsx/esm/api").register(); state.tsx = true; return true; } +function tsxResolvedFrom(projectDir) { + const bases = [import.meta.url, ...[projectDir, process.cwd()].filter((d) => d !== void 0).map((d) => join6(d, "package.json"))]; + for (const base of bases) { + try { + nodeModule.createRequire(base).resolve("tsx/cjs/api"); + return base; + } catch { + } + } + return void 0; +} function ensureTypeScriptLoaderFor(pathOrUrl) { if (!isJavaScriptModule(pathOrUrl)) return ensureTypeScriptLoader(); @@ -234985,11 +234997,30 @@ var init_ts_loader = __esm({ }); // node_modules/@intentius/chant/dist/config-import.js +import { dirname as dirname8, join as join7 } from "node:path"; import { pathToFileURL as pathToFileURL4 } from "node:url"; async function importConfigModule(configPath2, fresh = false) { - ensureTypeScriptLoader(); + let noTsx = null; + try { + ensureTypeScriptLoader(dirname8(configPath2)); + } catch (err) { + if (!(err instanceof Error) || !err.message.startsWith("chant needs tsx") || !nativeTypeScript()) + throw err; + noTsx = err; + } const specifier = fresh ? `${pathToFileURL4(configPath2).href}?fresh=${++freshLoads}` : configPath2; - return await import(specifier); + try { + return await import(specifier); + } catch (err) { + if (noTsx === null) + throw err; + const why = String(err instanceof Error ? err.message : err).split("\n")[0]; + throw Object.assign(new Error(`${noTsx.message} (node's own type stripping could not read ${configPath2} either: ${why})`), { cause: err }); + } +} +function nativeTypeScript() { + const ts45 = process.features.typescript; + return ts45 === "strip" || ts45 === "transform"; } var freshLoads; var init_config_import = __esm({ @@ -237526,7 +237557,7 @@ error: ${text}`); import { existsSync as existsSync6, mkdtempSync, readFileSync as readFileSync4, realpathSync as realpathSync2, rmSync, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs"; import { createRequire as createRequire4 } from "node:module"; import { tmpdir } from "node:os"; -import { dirname as dirname8, join as join7, resolve as resolvePath } from "node:path"; +import { dirname as dirname9, join as join8, resolve as resolvePath } from "node:path"; function getExternalPackagePathCache() { const g = globalThis; return g.__chantExternalPackagePathCache ?? (g.__chantExternalPackagePathCache = /* @__PURE__ */ new Map()); @@ -237534,9 +237565,9 @@ function getExternalPackagePathCache() { function fastResolvePackage(specifier, fromDir) { let dir = fromDir; for (; ; ) { - const packageDir = join7(dir, "node_modules", specifier); + const packageDir = join8(dir, "node_modules", specifier); if (existsSync6(packageDir)) { - const pkgJsonPath = join7(packageDir, "package.json"); + const pkgJsonPath = join8(packageDir, "package.json"); if (!existsSync6(pkgJsonPath)) return void 0; let pkg; @@ -237559,7 +237590,7 @@ function fastResolvePackage(specifier, fromDir) { return void 0; } } - const parent = dirname8(dir); + const parent = dirname9(dir); if (parent === dir) return void 0; dir = parent; @@ -237579,7 +237610,7 @@ function externalTrustedPackagesPlugin() { if (path === void 0) continue; resolved.set(name, path); - readPaths.push(dirname8(path)); + readPaths.push(dirname9(path)); } catch { pathCache.set(name, void 0); } @@ -237609,10 +237640,10 @@ function chantCoreSourcePlugin() { }; } async function bundleDriver(driverSource) { - const bundleDir = realpathSync2(mkdtempSync(join7(tmpdir(), "chant-sandbox-"))); - const entryPath = join7(bundleDir, "driver.mts"); + const bundleDir = realpathSync2(mkdtempSync(join8(tmpdir(), "chant-sandbox-"))); + const entryPath = join8(bundleDir, "driver.mts"); writeFileSync2(entryPath, driverSource, "utf-8"); - const outfile = join7(bundleDir, "child.mjs"); + const outfile = join8(bundleDir, "child.mjs"); const { plugin, readPaths } = externalTrustedPackagesPlugin(); let esbuildModule; try { @@ -237665,7 +237696,7 @@ var init_params = __esm({ }); // node_modules/@intentius/chant/dist/discovery/sandbox/driver.js -import { dirname as dirname9, join as join8 } from "node:path"; +import { dirname as dirname10, join as join9 } from "node:path"; function lit(value) { return JSON.stringify(value); } @@ -237745,17 +237776,17 @@ var init_driver = __esm({ init_params(); init_ts_loader(); HERE2 = chantSourceDir(import.meta.url); - DISCOVERY_DIR = join8(HERE2, ".."); - COLLECT_MODULE = chantModule(join8(DISCOVERY_DIR, "collect.ts")); - RESOLVE_MODULE = chantModule(join8(DISCOVERY_DIR, "resolve.ts")); - ENTITY_WIRE_CODEC_MODULE = chantModule(join8(DISCOVERY_DIR, "entity-wire-codec.ts")); - CHILD_ERRORS_MODULE = chantModule(join8(HERE2, "child-errors.ts")); - PROVENANCE_MODULE = chantModule(join8(dirname9(DISCOVERY_DIR), "provenance.ts")); - CONFIG_WIRE_MODULE = chantModule(join8(HERE2, "config-wire.ts")); - POLICY_WIRE_MODULE = chantModule(join8(HERE2, "policy-wire.ts")); - POST_SYNTH_MODULE = chantModule(join8(dirname9(DISCOVERY_DIR), "lint", "post-synth.ts")); - PARAMS_MODULE = chantModule(join8(dirname9(DISCOVERY_DIR), "params.ts")); - INTEROP_MODULE = chantModule(join8(dirname9(DISCOVERY_DIR), "module-interop.ts")); + DISCOVERY_DIR = join9(HERE2, ".."); + COLLECT_MODULE = chantModule(join9(DISCOVERY_DIR, "collect.ts")); + RESOLVE_MODULE = chantModule(join9(DISCOVERY_DIR, "resolve.ts")); + ENTITY_WIRE_CODEC_MODULE = chantModule(join9(DISCOVERY_DIR, "entity-wire-codec.ts")); + CHILD_ERRORS_MODULE = chantModule(join9(HERE2, "child-errors.ts")); + PROVENANCE_MODULE = chantModule(join9(dirname10(DISCOVERY_DIR), "provenance.ts")); + CONFIG_WIRE_MODULE = chantModule(join9(HERE2, "config-wire.ts")); + POLICY_WIRE_MODULE = chantModule(join9(HERE2, "policy-wire.ts")); + POST_SYNTH_MODULE = chantModule(join9(dirname10(DISCOVERY_DIR), "lint", "post-synth.ts")); + PARAMS_MODULE = chantModule(join9(dirname10(DISCOVERY_DIR), "params.ts")); + INTEROP_MODULE = chantModule(join9(dirname10(DISCOVERY_DIR), "module-interop.ts")); } }); @@ -237976,12 +238007,12 @@ var init_config_run = __esm({ }); // node_modules/@intentius/chant/dist/config-sandbox.js -import { dirname as dirname10 } from "node:path"; +import { dirname as dirname11 } from "node:path"; function selectConfigExport(namespace) { const ns = esModuleNamespace(namespace); return ns.default ?? ns.config ?? ns; } -async function evaluateProjectConfig(configPath2, projectRoot = dirname10(configPath2), fresh = false) { +async function evaluateProjectConfig(configPath2, projectRoot = dirname11(configPath2), fresh = false) { if (!armed) { return selectConfigExport(await importConfigModule(configPath2, fresh)); } @@ -238004,7 +238035,7 @@ var init_config_sandbox = __esm({ // node_modules/@intentius/chant/dist/lexicon-module.js import { createRequire as createRequire5 } from "node:module"; -import { dirname as dirname11, isAbsolute, join as join9, relative as relative2, resolve as resolve6, sep as sep3 } from "node:path"; +import { dirname as dirname12, isAbsolute, join as join10, relative as relative2, resolve as resolve6, sep as sep3 } from "node:path"; import { pathToFileURL as pathToFileURL5 } from "node:url"; function lexiconDeclarationName(entry) { return typeof entry === "string" ? entry : entry.name; @@ -238019,7 +238050,7 @@ function isWithin(path, dir) { function pathLexiconRoot(entry, baseDir, sourceDir = ".") { const modulePath = isAbsolute(entry.module) ? entry.module : resolve6(baseDir, entry.module); const declared = entry.root !== void 0; - const candidate = declared ? isAbsolute(entry.root) ? resolve6(entry.root) : resolve6(baseDir, entry.root) : dirname11(modulePath); + const candidate = declared ? isAbsolute(entry.root) ? resolve6(entry.root) : resolve6(baseDir, entry.root) : dirname12(modulePath); const project2 = resolve6(baseDir); const source = resolve6(baseDir, sourceDir); let problem; @@ -238096,7 +238127,7 @@ function isPackageNotFound(err, pkg) { } function resolveFromProject(spec, fromDir = process.cwd()) { try { - return createRequire5(join9(fromDir, "package.json")).resolve(spec); + return createRequire5(join10(fromDir, "package.json")).resolve(spec); } catch { return void 0; } @@ -238217,8 +238248,7 @@ var init_publish_declaration = __esm({ stage: external_exports.boolean().optional(), /** * A variable holding an npm token to retry with when a package's publish - * fails to authenticate (#4040), as chant's own publish-packages.sh does: - * a package whose trusted-publisher record is broken publishes with the + * fails to authenticate (#4040): a package whose trusted-publisher record is broken publishes with the * token rather than failing the release. Unset or empty, there is no retry. */ tokenEnv: envName.optional(), @@ -238244,8 +238274,15 @@ var init_publish_declaration = __esm({ image: external_exports.string().min(1), /** `/`, such as `ghcr.io/acme/api` or `docker.io/acme/api`. */ repository: external_exports.string().min(1), - /** Tags to point at the pushed digest. `{label}` is the release's label. Default: `["{label}"]`, or none for a release with no label. */ + /** Tags to point at the pushed digest. `{label}` is the release's label and `{version}` the label from its first digit (#5269). Default: `["{label}"]`, or none for a release with no label. */ tags: external_exports.array(external_exports.string().min(1)).optional(), + /** + * Tags for each platform's image in an index (#5269), such as `["{label}-{arch}"]`: `{arch}` is the + * platform's architecture with its variant (`amd64`, `arm64`, `armv7`), `{os}` its OS and `{label}` the + * release's label (`{version}`, the label from its first digit). Each names `{label}` or `{version}`, so it + * belongs to the release and no status change moves it. + */ + platformTags: external_exports.array(external_exports.string().min(1).refine((t) => (t.includes("{label}") || t.includes("{version}")) && t.includes("{arch}"), { message: "a platform tag names {arch} and {label} or {version}, such as {label}-{arch}" })).min(1).optional(), /** The variable holding the registry user name. Default `OCI_USERNAME`. */ usernameEnv: envName.optional(), /** The variable holding the registry password or token. Default `OCI_PASSWORD`. */ @@ -238288,11 +238325,15 @@ var init_publish_declaration = __esm({ generate: external_exports.enum(["forge", "commits"]).optional(), /** With `generate: "commits"`: the commit types listed. Default `feat`, `fix` and `perf`. A breaking change is listed whatever its type; `*` lists every commit. */ types: external_exports.array(external_exports.string().min(1)).min(1).optional(), + /** With `generate: "commits"`, instead of `types` (#5270): the commit types left out, such as `docs`, `test` and `chore`; every other commit is listed, conventional or not. */ + exclude: external_exports.array(external_exports.string().regex(/^\w+$/, "a commit type, such as docs")).min(1).optional(), + /** With `generate: "commits"` (#5270): list the commits whose subject is not conventional. Default `true` with `exclude` or `types: ["*"]`, `false` with a list of types. */ + nonConventional: external_exports.boolean().optional(), /** A paragraph before the notes, with the same placeholders. */ before: external_exports.string().min(1).optional(), /** A paragraph after the notes, with the same placeholders. */ after: external_exports.string().min(1).optional() - }).strict().refine((n) => n.file === void 0 === (n.heading === void 0), { message: "notes.file and notes.heading go together", path: ["heading"] }).refine((n) => n.file !== void 0 || n.generate !== void 0, { message: "notes need a file section, generate, or both", path: ["generate"] }).refine((n) => n.types === void 0 || n.generate === "commits", { message: 'notes.types applies to generate: "commits"', path: ["types"] }).optional(), + }).strict().refine((n) => n.file === void 0 === (n.heading === void 0), { message: "notes.file and notes.heading go together", path: ["heading"] }).refine((n) => n.file !== void 0 || n.generate !== void 0, { message: "notes need a file section, generate, or both", path: ["generate"] }).refine((n) => n.types === void 0 || n.generate === "commits", { message: 'notes.types applies to generate: "commits"', path: ["types"] }).refine((n) => n.exclude === void 0 || n.generate === "commits", { message: 'notes.exclude applies to generate: "commits"', path: ["exclude"] }).refine((n) => n.nonConventional === void 0 || n.generate === "commits", { message: 'notes.nonConventional applies to generate: "commits"', path: ["nonConventional"] }).refine((n) => n.exclude === void 0 || n.types === void 0, { message: "notes.types lists types and notes.exclude leaves them out: name one", path: ["exclude"] }).optional(), /** The forge release's tag. Default: the tag the cut made, from `release.tag` (#5150; `release/