@git.zone/cli 8.10.1 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/{asset_deno_binary_installer → asset_binary_installer}/install.sh +2 -2
- package/assets/templates/{asset_deno_binary_postinstall → asset_binary_postinstall}/bin/wrapper.js +2 -2
- package/assets/templates/{asset_deno_binary_postinstall → asset_binary_postinstall}/scripts/install-binary.js +2 -2
- package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +180 -0
- package/assets/templates/asset_tspack_release_gitea/.gitea/workflows/release.yml +7 -4
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.d.mts +9 -3
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-gitea-tag.mjs +50 -6
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-release-api.mjs +7 -6
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/helpers.managedassets.d.ts +44 -0
- package/dist_ts/helpers.managedassets.js +166 -0
- package/dist_ts/helpers.ownerscopes.d.ts +4 -16
- package/dist_ts/helpers.ownerscopes.js +5 -16
- package/dist_ts/helpers.packagefiles.d.ts +2 -1
- package/dist_ts/helpers.packagefiles.js +7 -4
- package/dist_ts/helpers.sealedrelease.js +3 -3
- package/dist_ts/helpers.tssea.d.ts +11 -0
- package/dist_ts/helpers.tssea.js +81 -0
- package/dist_ts/helpers.workflow.d.ts +2 -3
- package/dist_ts/helpers.workflow.js +9 -19
- package/dist_ts/index.d.ts +1 -1
- package/dist_ts/index.js +2 -2
- package/dist_ts/mod_commit/mod.helpers.d.ts +8 -21
- package/dist_ts/mod_commit/mod.helpers.js +32 -83
- package/dist_ts/mod_commit/mod.ui.js +1 -5
- package/dist_ts/mod_config/index.js +41 -33
- package/dist_ts/mod_format/formatters/assets.formatter.js +42 -92
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +3 -3
- package/dist_ts/mod_format/index.js +30 -11
- package/dist_ts/mod_format/interfaces.format.js +1 -2
- package/dist_ts/mod_release/classes.releasejournal.d.ts +63 -2
- package/dist_ts/mod_release/classes.releasejournal.js +247 -48
- package/dist_ts/mod_release/helpers.giteaassets.js +18 -9
- package/dist_ts/mod_release/helpers.releasepreparation.d.ts +6 -14
- package/dist_ts/mod_release/helpers.releasepreparation.js +27 -53
- package/dist_ts/mod_release/index.js +108 -13
- package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +2 -2
- package/dist_ts/mod_services/classes.serviceoptions.d.ts +2 -2
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +4 -2
- package/package.json +3 -2
- package/readme.md +153 -74
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.managedassets.ts +215 -0
- package/ts/helpers.ownerscopes.ts +4 -15
- package/ts/helpers.packagefiles.ts +6 -3
- package/ts/helpers.sealedrelease.ts +2 -2
- package/ts/helpers.tssea.ts +102 -0
- package/ts/helpers.workflow.ts +12 -28
- package/ts/index.ts +1 -1
- package/ts/mod_commit/mod.helpers.ts +33 -94
- package/ts/mod_commit/mod.ui.ts +0 -4
- package/ts/mod_config/index.ts +47 -35
- package/ts/mod_format/formatters/assets.formatter.ts +47 -108
- package/ts/mod_format/formatters/packagejson.formatter.ts +2 -2
- package/ts/mod_format/index.ts +36 -10
- package/ts/mod_format/interfaces.format.ts +0 -1
- package/ts/mod_release/classes.releasejournal.ts +323 -52
- package/ts/mod_release/helpers.giteaassets.ts +19 -10
- package/ts/mod_release/helpers.releasepreparation.ts +36 -69
- package/ts/mod_release/index.ts +138 -18
- package/ts/mod_services/classes.serviceconfiguration.ts +2 -2
- package/ts/mod_services/classes.serviceoptions.ts +2 -2
- package/ts/plugins.ts +4 -0
- package/assets/templates/asset_deno_binary_release_gitea/.gitea/workflows/release.yml +0 -154
- package/assets/templates/multienv/deno.json +0 -8
- package/dist_ts/mod_format/formatters/deno.formatter.d.ts +0 -18
- package/dist_ts/mod_format/formatters/deno.formatter.js +0 -175
- package/ts/mod_format/formatters/deno.formatter.ts +0 -219
|
@@ -2,11 +2,6 @@ import * as plugins from "./mod.plugins.js";
|
|
|
2
2
|
import type { IResolvedReleaseWorkflow } from "../helpers.workflow.js";
|
|
3
3
|
import { logger } from "../gitzone.logging.js";
|
|
4
4
|
import { readPendingChangelog } from "../helpers.changelog.js";
|
|
5
|
-
import {
|
|
6
|
-
detectProjectType,
|
|
7
|
-
projectTypeHasPackageJson,
|
|
8
|
-
type ProjectType,
|
|
9
|
-
} from "../mod_commit/mod.helpers.js";
|
|
10
5
|
import { InterProcessLock } from "../mod_services/classes.interprocesslock.js";
|
|
11
6
|
import { ReleaseJournalStore } from "./classes.releasejournal.js";
|
|
12
7
|
import {
|
|
@@ -342,31 +337,12 @@ export const getReleaseCommandEnvironment = async (
|
|
|
342
337
|
};
|
|
343
338
|
|
|
344
339
|
/**
|
|
345
|
-
* The release checkout
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
|
|
351
|
-
export const detectReleaseCommitProjectType = async (
|
|
352
|
-
options: IReleaseSourceCommit,
|
|
353
|
-
): Promise<ProjectType> => {
|
|
354
|
-
const hasPackageJson = await commitCarriesBlob(options, "package.json");
|
|
355
|
-
const hasDenoJson = await commitCarriesBlob(options, "deno.json");
|
|
356
|
-
if (hasPackageJson && hasDenoJson) return "both";
|
|
357
|
-
if (hasPackageJson) return "npm";
|
|
358
|
-
if (hasDenoJson) return "deno";
|
|
359
|
-
throw new Error(
|
|
360
|
-
`Commit ${options.sourceOid} tracks neither package.json nor deno.json, so it carries no release version file.`,
|
|
361
|
-
);
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* The isolated release checkout of a project with a package.json installs with
|
|
366
|
-
* `pnpm install --frozen-lockfile`, so a lockfile that the release commit does
|
|
367
|
-
* not carry, or that no longer matches its manifest, would fail a release that
|
|
368
|
-
* already created its commit and tag. Preflight proves both before anything is
|
|
369
|
-
* created. A Deno-only commit installs nothing, so it is asked for nothing.
|
|
340
|
+
* The isolated release checkout installs with `pnpm install --frozen-lockfile`,
|
|
341
|
+
* so a package.json or lockfile that the release commit does not carry, or a
|
|
342
|
+
* lockfile that no longer matches its manifest, would fail a release that
|
|
343
|
+
* already created its commit and tag. Preflight proves all three before
|
|
344
|
+
* anything is created. The release commit is what counts, not the working
|
|
345
|
+
* folder: an ignored package.json is not part of the release.
|
|
370
346
|
*
|
|
371
347
|
* The release commit only adds the version bump, the baked commit info, and the
|
|
372
348
|
* changelog section on top of the source commit, and a version change never
|
|
@@ -375,13 +351,10 @@ export const detectReleaseCommitProjectType = async (
|
|
|
375
351
|
export const assertReleaseCheckoutInstallable = async (
|
|
376
352
|
options: IReleaseSourceCommit,
|
|
377
353
|
): Promise<void> => {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
"info",
|
|
382
|
-
"The release commit carries no package.json, so its checkout runs the configured commands against the committed tree without installing npm dependencies",
|
|
354
|
+
if (!(await commitCarriesBlob(options, "package.json"))) {
|
|
355
|
+
throw new Error(
|
|
356
|
+
`Commit ${options.sourceOid} tracks no package.json: gitzone commit and release version the package.json.`,
|
|
383
357
|
);
|
|
384
|
-
return;
|
|
385
358
|
}
|
|
386
359
|
logger.log(
|
|
387
360
|
"info",
|
|
@@ -498,40 +471,34 @@ export const withIsolatedReleaseCheckout = async <T>(
|
|
|
498
471
|
cwd: checkout,
|
|
499
472
|
sourceOid: options.mainOid,
|
|
500
473
|
});
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
474
|
+
const install = await options.smartshell.execSpawn(
|
|
475
|
+
"pnpm",
|
|
476
|
+
[
|
|
477
|
+
"install",
|
|
478
|
+
"--frozen-lockfile",
|
|
479
|
+
...(env.PNPM_CONFIG_IGNORE_WORKSPACE === "true"
|
|
480
|
+
? ["--ignore-workspace"]
|
|
481
|
+
: []),
|
|
482
|
+
],
|
|
483
|
+
{
|
|
484
|
+
cwd: checkout,
|
|
485
|
+
env,
|
|
486
|
+
timeout: 10 * 60_000,
|
|
487
|
+
timeoutKillGraceMs: 5_000,
|
|
488
|
+
},
|
|
489
|
+
);
|
|
490
|
+
if (install.exitCode !== 0)
|
|
491
|
+
throw new Error(
|
|
492
|
+
formatCommandFailure(
|
|
493
|
+
"Release checkout dependency installation failed.",
|
|
494
|
+
install,
|
|
495
|
+
{
|
|
496
|
+
command: "pnpm install --frozen-lockfile",
|
|
497
|
+
timeoutMs: 10 * 60_000,
|
|
498
|
+
output: "combined",
|
|
499
|
+
},
|
|
500
|
+
),
|
|
521
501
|
);
|
|
522
|
-
if (install.exitCode !== 0)
|
|
523
|
-
throw new Error(
|
|
524
|
-
formatCommandFailure(
|
|
525
|
-
"Release checkout dependency installation failed.",
|
|
526
|
-
install,
|
|
527
|
-
{
|
|
528
|
-
command: "pnpm install --frozen-lockfile",
|
|
529
|
-
timeoutMs: 10 * 60_000,
|
|
530
|
-
output: "combined",
|
|
531
|
-
},
|
|
532
|
-
),
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
502
|
if (options.testCommand)
|
|
536
503
|
await run(
|
|
537
504
|
options.smartshell,
|
package/ts/mod_release/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
resolveReleaseDockerConfiguration,
|
|
14
14
|
resolveReleaseWorkflow,
|
|
15
15
|
resolveReleaseResumeConfiguration,
|
|
16
|
+
readReleaseRecordRetention,
|
|
16
17
|
assertGiteaAssetsGitDestination,
|
|
17
18
|
type IResolvedReleaseResumeConfiguration,
|
|
18
19
|
type IResolvedReleaseWorkflow,
|
|
@@ -50,7 +51,9 @@ import {
|
|
|
50
51
|
type IReleaseJournalV2,
|
|
51
52
|
releaseIntentKind,
|
|
52
53
|
type IReleaseIntent,
|
|
54
|
+
type IReleaseRecordPruneReport,
|
|
53
55
|
} from "./classes.releasejournal.js";
|
|
56
|
+
import { formatBytes } from "../mod_services/helpers.js";
|
|
54
57
|
import { createReleaseGitRemotePolicy } from "./helpers.gitremote.js";
|
|
55
58
|
import {
|
|
56
59
|
GiteaAssetsClient,
|
|
@@ -175,6 +178,10 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
175
178
|
await runReleaseRecover(argvArg, mode);
|
|
176
179
|
return;
|
|
177
180
|
}
|
|
181
|
+
if (subcommand === "prune") {
|
|
182
|
+
await runReleasePrune(argvArg, mode);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
178
185
|
if (subcommand !== undefined) {
|
|
179
186
|
throw new Error(`Unknown release subcommand: ${subcommand}`);
|
|
180
187
|
}
|
|
@@ -238,7 +245,6 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
238
245
|
);
|
|
239
246
|
const versionResolution = resolveReleaseVersion({
|
|
240
247
|
currentVersion: await commitHelpers.readCurrentVersion(
|
|
241
|
-
workflow.projectType,
|
|
242
248
|
branchContext.sourceCwd,
|
|
243
249
|
),
|
|
244
250
|
pendingChangelog: pending.block,
|
|
@@ -328,10 +334,9 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
328
334
|
),
|
|
329
335
|
);
|
|
330
336
|
}
|
|
331
|
-
// A release that builds or packs does so in a checkout of its release commit
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
// created yet.
|
|
337
|
+
// A release that builds or packs does so in a checkout of its release commit,
|
|
338
|
+
// which installs from the committed lockfile: prove that install can succeed
|
|
339
|
+
// while nothing has been created yet.
|
|
335
340
|
if (releaseNeedsIsolatedCheckout(workflow)) {
|
|
336
341
|
await assertReleaseCheckoutInstallable({
|
|
337
342
|
smartshell: smartshellInstance,
|
|
@@ -385,7 +390,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
385
390
|
expectedRemoteMainOid = integration.expectedRemoteMainOid;
|
|
386
391
|
}
|
|
387
392
|
|
|
388
|
-
await runVersionStep(
|
|
393
|
+
await runVersionStep(versionResolution, releaseCwd);
|
|
389
394
|
await runChangelogStep(workflow, newVersion, releaseCwd);
|
|
390
395
|
const releaseCommitOid = await runReleaseCommitStep(
|
|
391
396
|
smartshellInstance,
|
|
@@ -1384,6 +1389,117 @@ const runReleaseInspect = async (
|
|
|
1384
1389
|
}
|
|
1385
1390
|
};
|
|
1386
1391
|
|
|
1392
|
+
/**
|
|
1393
|
+
* Applies record retention on demand, through the same store method a
|
|
1394
|
+
* completed release uses. Without `--apply` it only reports.
|
|
1395
|
+
*/
|
|
1396
|
+
const runReleasePrune = async (
|
|
1397
|
+
argvArg: any,
|
|
1398
|
+
modeArg: ICliMode,
|
|
1399
|
+
): Promise<void> => {
|
|
1400
|
+
try {
|
|
1401
|
+
const report = await pruneReleaseRecordsOnDemand(argvArg);
|
|
1402
|
+
if (modeArg.json) {
|
|
1403
|
+
printJson({ ok: true, ...report });
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
printReleasePruneReport(report);
|
|
1407
|
+
} catch (error) {
|
|
1408
|
+
if (!modeArg.json) throw error;
|
|
1409
|
+
printJson({
|
|
1410
|
+
ok: false,
|
|
1411
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1412
|
+
});
|
|
1413
|
+
process.exitCode = 1;
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
const pruneReleaseRecordsOnDemand = async (
|
|
1418
|
+
argvArg: any,
|
|
1419
|
+
): Promise<IReleaseRecordPruneReport> => {
|
|
1420
|
+
const allowed = new Set([
|
|
1421
|
+
"_",
|
|
1422
|
+
"$0",
|
|
1423
|
+
"apply",
|
|
1424
|
+
"keep",
|
|
1425
|
+
"json",
|
|
1426
|
+
"output",
|
|
1427
|
+
"plain",
|
|
1428
|
+
"quiet",
|
|
1429
|
+
"q",
|
|
1430
|
+
"agent",
|
|
1431
|
+
"interactive",
|
|
1432
|
+
"check-updates",
|
|
1433
|
+
"checkUpdates",
|
|
1434
|
+
]);
|
|
1435
|
+
if (
|
|
1436
|
+
argvArg._?.length !== 2 ||
|
|
1437
|
+
Object.keys(argvArg).some((key) => !allowed.has(key)) ||
|
|
1438
|
+
(argvArg.apply !== undefined && argvArg.apply !== true)
|
|
1439
|
+
) {
|
|
1440
|
+
throw new Error(
|
|
1441
|
+
"Usage: gitzone release prune [--apply] [--keep <n>] [--json]",
|
|
1442
|
+
);
|
|
1443
|
+
}
|
|
1444
|
+
let keep: number;
|
|
1445
|
+
if (argvArg.keep === undefined) {
|
|
1446
|
+
keep = await readReleaseRecordRetention();
|
|
1447
|
+
} else if (
|
|
1448
|
+
typeof argvArg.keep === "string" &&
|
|
1449
|
+
/^[1-9][0-9]*$/.test(argvArg.keep) &&
|
|
1450
|
+
Number.isSafeInteger(Number(argvArg.keep))
|
|
1451
|
+
) {
|
|
1452
|
+
keep = Number(argvArg.keep);
|
|
1453
|
+
} else {
|
|
1454
|
+
throw new Error("--keep must be a positive integer.");
|
|
1455
|
+
}
|
|
1456
|
+
const store = new ReleaseJournalStore(
|
|
1457
|
+
await resolveGitCommonDirectory(
|
|
1458
|
+
new plugins.smartshell.Smartshell({
|
|
1459
|
+
executor: "bash",
|
|
1460
|
+
sourceFilePaths: [],
|
|
1461
|
+
}),
|
|
1462
|
+
paths.cwd,
|
|
1463
|
+
),
|
|
1464
|
+
);
|
|
1465
|
+
const active = await store.findActiveReleaseState();
|
|
1466
|
+
if (active.length > 0) {
|
|
1467
|
+
throw new Error(
|
|
1468
|
+
`A release of this repository is in progress; prune refuses to run until it ends. ` +
|
|
1469
|
+
`If no release process is left, inspect and remove: ${active.join(", ")}`,
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
return store.pruneRecords({ keep, apply: argvArg.apply === true });
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1475
|
+
const printReleasePruneReport = (reportArg: IReleaseRecordPruneReport) => {
|
|
1476
|
+
console.log(
|
|
1477
|
+
`gitzone release prune - ${reportArg.dryRun ? "dry run" : "applied"}: newest ${reportArg.keep} completed records keep their payloads`,
|
|
1478
|
+
);
|
|
1479
|
+
if (reportArg.records.length === 0) {
|
|
1480
|
+
console.log("No release records found.");
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1483
|
+
for (const entry of reportArg.records) {
|
|
1484
|
+
console.log(
|
|
1485
|
+
` v${entry.version} ${entry.state} ${formatBytes(entry.bytes)} ${entry.action}: ${entry.reason}${entry.payloadBytes > 0 ? ` (payload ${formatBytes(entry.payloadBytes)})` : ""}${entry.detail ? ` - ${entry.detail}` : ""}`,
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
const { totals } = reportArg;
|
|
1489
|
+
console.log(
|
|
1490
|
+
`Records: ${totals.records} (kept ${totals.kept}, pruned ${totals.pruned}, blocked ${totals.blocked}); on disk ${formatBytes(totals.bytes)}`,
|
|
1491
|
+
);
|
|
1492
|
+
if (reportArg.records.some((entry) => entry.state === "invalid"))
|
|
1493
|
+
console.log(
|
|
1494
|
+
"An invalid journal stops --apply before anything is deleted; repair or remove that record first.",
|
|
1495
|
+
);
|
|
1496
|
+
console.log(
|
|
1497
|
+
reportArg.dryRun
|
|
1498
|
+
? `Would free ${formatBytes(totals.wouldFreeBytes)}. Run \`gitzone release prune --apply\` to delete it.`
|
|
1499
|
+
: `Freed ${formatBytes(totals.freedBytes)}.`,
|
|
1500
|
+
);
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1387
1503
|
const describeDetachedReleaseRun = (runArg: IDetachedReleaseRun): string => {
|
|
1388
1504
|
const release = `gitzone ${runArg.command.join(" ")} (v${runArg.version})`;
|
|
1389
1505
|
const outcome =
|
|
@@ -1738,6 +1854,10 @@ const runReleaseResumeFromStore = async (optionsArg: {
|
|
|
1738
1854
|
await prepareRecordedRelease(smartshellInstance, intent);
|
|
1739
1855
|
}
|
|
1740
1856
|
const journal = await store.read(version);
|
|
1857
|
+
if (journal.completedAt !== null && (await store.isPayloadMissing(journal)))
|
|
1858
|
+
throw new Error(
|
|
1859
|
+
`Release v${version} is complete and record retention removed its local artifacts; there is nothing left to resume. \`gitzone release inspect ${version}\` shows its journal.`,
|
|
1860
|
+
);
|
|
1741
1861
|
const gitEnabled = journal.git.state !== "skipped";
|
|
1742
1862
|
const resumeConfiguration = await resolveReleaseResumeConfiguration({
|
|
1743
1863
|
git: gitEnabled,
|
|
@@ -2132,14 +2252,10 @@ async function verifyCleanTree(
|
|
|
2132
2252
|
}
|
|
2133
2253
|
|
|
2134
2254
|
async function runVersionStep(
|
|
2135
|
-
projectType: commitHelpers.ProjectType,
|
|
2136
2255
|
resolutionArg: IReleaseVersionResolution,
|
|
2137
2256
|
cwdArg: string,
|
|
2138
2257
|
): Promise<void> {
|
|
2139
|
-
const currentVersion = await commitHelpers.readCurrentVersion(
|
|
2140
|
-
projectType,
|
|
2141
|
-
cwdArg,
|
|
2142
|
-
);
|
|
2258
|
+
const currentVersion = await commitHelpers.readCurrentVersion(cwdArg);
|
|
2143
2259
|
assertResolvedCurrentVersion(resolutionArg, currentVersion);
|
|
2144
2260
|
logger.log(
|
|
2145
2261
|
"info",
|
|
@@ -2147,11 +2263,7 @@ async function runVersionStep(
|
|
|
2147
2263
|
);
|
|
2148
2264
|
|
|
2149
2265
|
await writeCommitInfoFiles(cwdArg, resolutionArg.version);
|
|
2150
|
-
await commitHelpers.updateProjectVersionFiles(
|
|
2151
|
-
projectType,
|
|
2152
|
-
resolutionArg.version,
|
|
2153
|
-
cwdArg,
|
|
2154
|
-
);
|
|
2266
|
+
await commitHelpers.updateProjectVersionFiles(resolutionArg.version, cwdArg);
|
|
2155
2267
|
}
|
|
2156
2268
|
|
|
2157
2269
|
async function runChangelogStep(
|
|
@@ -2713,7 +2825,7 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
2713
2825
|
printJson({
|
|
2714
2826
|
command: "release",
|
|
2715
2827
|
usage:
|
|
2716
|
-
"gitzone release [inspect [version]|resume <version>|recover <version
|
|
2828
|
+
"gitzone release [inspect [version]|resume <version>|recover <version>|prune] [options]",
|
|
2717
2829
|
description:
|
|
2718
2830
|
"Creates a versioned release from pending changelog entries and publishes configured artifacts.",
|
|
2719
2831
|
flags: [
|
|
@@ -2773,6 +2885,11 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
2773
2885
|
description:
|
|
2774
2886
|
"Recover a local npm and/or Docker release tag created without a recorded intent after build or pack failure before journal creation",
|
|
2775
2887
|
},
|
|
2888
|
+
{
|
|
2889
|
+
flag: "prune [--apply] [--keep <n>]",
|
|
2890
|
+
description:
|
|
2891
|
+
"Report, and with --apply delete, the npm tarballs and Gitea assets of completed release records beyond the newest release.recordRetention (or --keep); journals, incomplete and in-use records stay",
|
|
2892
|
+
},
|
|
2776
2893
|
{
|
|
2777
2894
|
flag: "--recover-attempt <id>",
|
|
2778
2895
|
description:
|
|
@@ -2790,7 +2907,7 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
2790
2907
|
|
|
2791
2908
|
console.log("");
|
|
2792
2909
|
console.log(
|
|
2793
|
-
"Usage: gitzone release [inspect [version]|resume <version>|recover <version
|
|
2910
|
+
"Usage: gitzone release [inspect [version]|resume <version>|recover <version>|prune] [options]",
|
|
2794
2911
|
);
|
|
2795
2912
|
console.log("");
|
|
2796
2913
|
console.log("Creates a versioned release from changelog Pending entries.");
|
|
@@ -2831,6 +2948,9 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
2831
2948
|
console.log(
|
|
2832
2949
|
" recover <version> Recover an unpublished npm and/or Docker release tag created without a recorded intent",
|
|
2833
2950
|
);
|
|
2951
|
+
console.log(
|
|
2952
|
+
" prune Report payloads of completed records beyond release.recordRetention; --apply deletes them, --keep <n> overrides the count",
|
|
2953
|
+
);
|
|
2834
2954
|
console.log(
|
|
2835
2955
|
" --recover-attempt Recover one exact 32-character hexadecimal attempt ID after proving its publisher stopped",
|
|
2836
2956
|
);
|
|
@@ -149,8 +149,8 @@ export interface IServiceConfig extends IServicePlatformEnvironment {
|
|
|
149
149
|
MONGODB_URL: string;
|
|
150
150
|
/**
|
|
151
151
|
* When false, the NoSQLDB engine runs without authentication. It is always
|
|
152
|
-
* published on loopback only. Opt-in, for
|
|
153
|
-
*
|
|
152
|
+
* published on loopback only. Opt-in, for clients that cannot complete a SCRAM
|
|
153
|
+
* handshake. Defaults to true.
|
|
154
154
|
*/
|
|
155
155
|
MONGODB_AUTH_ENABLED: boolean;
|
|
156
156
|
/**
|
|
@@ -24,8 +24,8 @@ export const serviceOptionsConfigKey = 'serviceOptions';
|
|
|
24
24
|
export interface IMongodbServiceOptions {
|
|
25
25
|
/**
|
|
26
26
|
* When false, mongod runs without authentication and is published on
|
|
27
|
-
* loopback only. Opt-in, for
|
|
28
|
-
*
|
|
27
|
+
* loopback only. Opt-in, for clients that cannot complete a SCRAM handshake.
|
|
28
|
+
* Absent means enabled.
|
|
29
29
|
*/
|
|
30
30
|
auth?: boolean;
|
|
31
31
|
}
|
package/ts/plugins.ts
CHANGED
|
@@ -9,6 +9,8 @@ import * as crypto from 'node:crypto';
|
|
|
9
9
|
import * as fsSync from 'node:fs';
|
|
10
10
|
import * as childProcess from 'node:child_process';
|
|
11
11
|
import * as tty from 'node:tty';
|
|
12
|
+
import * as nodeModule from 'node:module';
|
|
13
|
+
import * as nodeUrl from 'node:url';
|
|
12
14
|
import * as projectinfo from '@push.rocks/projectinfo';
|
|
13
15
|
import * as smartconsole from '@push.rocks/smartconsole';
|
|
14
16
|
import * as smartpath from '@push.rocks/smartpath';
|
|
@@ -62,6 +64,8 @@ export {
|
|
|
62
64
|
fsSync,
|
|
63
65
|
childProcess,
|
|
64
66
|
tty,
|
|
67
|
+
nodeModule,
|
|
68
|
+
nodeUrl,
|
|
65
69
|
projectinfo,
|
|
66
70
|
smartconsole,
|
|
67
71
|
smartpath,
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build-and-release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
container:
|
|
12
|
-
image: code.foss.global/host.today/ht-docker-node:latest
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- name: Checkout code
|
|
16
|
-
uses: actions/checkout@v4
|
|
17
|
-
with:
|
|
18
|
-
fetch-depth: 0
|
|
19
|
-
|
|
20
|
-
- name: Set up Deno
|
|
21
|
-
uses: denoland/setup-deno@v1
|
|
22
|
-
with:
|
|
23
|
-
deno-version: v2.x
|
|
24
|
-
|
|
25
|
-
- name: Set up Node.js
|
|
26
|
-
uses: actions/setup-node@v4
|
|
27
|
-
with:
|
|
28
|
-
node-version: '22'
|
|
29
|
-
|
|
30
|
-
- name: Enable corepack
|
|
31
|
-
run: corepack enable
|
|
32
|
-
|
|
33
|
-
- name: Install dependencies
|
|
34
|
-
run: {{{releaseWorkflow.installCommand}}}
|
|
35
|
-
|
|
36
|
-
- name: Get version from tag
|
|
37
|
-
id: version
|
|
38
|
-
run: |
|
|
39
|
-
VERSION=${GITHUB_REF#refs/tags/}
|
|
40
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
41
|
-
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
|
|
42
|
-
echo "Building version: $VERSION"
|
|
43
|
-
|
|
44
|
-
- name: Verify version files match tag
|
|
45
|
-
run: |
|
|
46
|
-
TAG_VERSION="${-{ steps.version.outputs.version_number }-}"
|
|
47
|
-
if [ -f package.json ]; then
|
|
48
|
-
PACKAGE_VERSION=$(node -p "JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version || ''")
|
|
49
|
-
echo "package.json version: $PACKAGE_VERSION"
|
|
50
|
-
if [ -n "$PACKAGE_VERSION" ] && [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
|
|
51
|
-
echo "ERROR: package.json has version $PACKAGE_VERSION but tag is $TAG_VERSION"
|
|
52
|
-
exit 1
|
|
53
|
-
fi
|
|
54
|
-
fi
|
|
55
|
-
if [ -f deno.json ]; then
|
|
56
|
-
DENO_VERSION=$(node -p "JSON.parse(require('fs').readFileSync('deno.json', 'utf8')).version || ''")
|
|
57
|
-
echo "deno.json version: $DENO_VERSION"
|
|
58
|
-
if [ -n "$DENO_VERSION" ] && [ "$DENO_VERSION" != "$TAG_VERSION" ]; then
|
|
59
|
-
echo "ERROR: deno.json has version $DENO_VERSION but tag is $TAG_VERSION"
|
|
60
|
-
exit 1
|
|
61
|
-
fi
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
- name: Build binary artifacts
|
|
65
|
-
run: {{{releaseWorkflow.compileCommand}}}
|
|
66
|
-
|
|
67
|
-
{{#if releaseWorkflow.includeInstallerAsset}}
|
|
68
|
-
- name: Stage installer asset
|
|
69
|
-
run: |
|
|
70
|
-
install -m 0755 "{{installer.file}}" "{{releaseWorkflow.binaryOutDir}}/{{installer.releaseAssetName}}"
|
|
71
|
-
echo "Installer asset staged: {{releaseWorkflow.binaryOutDir}}/{{installer.releaseAssetName}}"
|
|
72
|
-
|
|
73
|
-
{{/if}}
|
|
74
|
-
- name: Generate SHA256 checksums
|
|
75
|
-
run: |
|
|
76
|
-
if [ -d "{{releaseWorkflow.binaryOutDir}}" ]; then
|
|
77
|
-
cd "{{releaseWorkflow.binaryOutDir}}"
|
|
78
|
-
sha256sum * > SHA256SUMS.txt
|
|
79
|
-
cat SHA256SUMS.txt
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
{{#if releaseWorkflow.packNpmArtifact}}
|
|
83
|
-
- name: Pack npm artifact
|
|
84
|
-
run: |
|
|
85
|
-
mkdir -p dist/package
|
|
86
|
-
pnpm pack --pack-destination dist/package
|
|
87
|
-
ls -lh dist/package
|
|
88
|
-
|
|
89
|
-
{{/if}}
|
|
90
|
-
- name: Extract release notes
|
|
91
|
-
run: |
|
|
92
|
-
VERSION="${-{ steps.version.outputs.version }-}"
|
|
93
|
-
if [ -f changelog.md ]; then
|
|
94
|
-
awk "/## $VERSION/,/## /" changelog.md | sed '$d' > /tmp/release_notes.md || true
|
|
95
|
-
fi
|
|
96
|
-
if [ ! -s /tmp/release_notes.md ]; then
|
|
97
|
-
cat > /tmp/release_notes.md << EOF
|
|
98
|
-
## {{displayName}} $VERSION
|
|
99
|
-
|
|
100
|
-
Pre-compiled release assets for {{displayName}}.
|
|
101
|
-
|
|
102
|
-
Installation:
|
|
103
|
-
curl -sSL {{{installer.releaseNotesInstallUrl}}} | sudo bash
|
|
104
|
-
EOF
|
|
105
|
-
fi
|
|
106
|
-
cat /tmp/release_notes.md
|
|
107
|
-
|
|
108
|
-
- name: Create or update Gitea release
|
|
109
|
-
id: release
|
|
110
|
-
run: |
|
|
111
|
-
VERSION="${-{ steps.version.outputs.version }-}"
|
|
112
|
-
EXISTING_RELEASE_ID=$(curl -s \
|
|
113
|
-
-H "Authorization: token ${-{ secrets.GITHUB_TOKEN }-}" \
|
|
114
|
-
"https://{{repository.host}}/api/v1/repos/{{repository.path}}/releases/tags/$VERSION" \
|
|
115
|
-
| jq -r '.id // empty')
|
|
116
|
-
|
|
117
|
-
if [ -n "$EXISTING_RELEASE_ID" ]; then
|
|
118
|
-
echo "Updating existing release ID: $EXISTING_RELEASE_ID"
|
|
119
|
-
curl -X PATCH -s \
|
|
120
|
-
-H "Authorization: token ${-{ secrets.GITHUB_TOKEN }-}" \
|
|
121
|
-
-H "Content-Type: application/json" \
|
|
122
|
-
"https://{{repository.host}}/api/v1/repos/{{repository.path}}/releases/$EXISTING_RELEASE_ID" \
|
|
123
|
-
-d "{\"name\": \"{{displayName}} $VERSION\", \"body\": $(jq -Rs . /tmp/release_notes.md), \"draft\": false, \"prerelease\": false}"
|
|
124
|
-
echo "release_id=$EXISTING_RELEASE_ID" >> $GITHUB_OUTPUT
|
|
125
|
-
else
|
|
126
|
-
RELEASE_ID=$(curl -X POST -s \
|
|
127
|
-
-H "Authorization: token ${-{ secrets.GITHUB_TOKEN }-}" \
|
|
128
|
-
-H "Content-Type: application/json" \
|
|
129
|
-
"https://{{repository.host}}/api/v1/repos/{{repository.path}}/releases" \
|
|
130
|
-
-d "{\"tag_name\": \"$VERSION\", \"name\": \"{{displayName}} $VERSION\", \"body\": $(jq -Rs . /tmp/release_notes.md), \"draft\": false, \"prerelease\": false}" \
|
|
131
|
-
| jq -r '.id')
|
|
132
|
-
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
|
133
|
-
fi
|
|
134
|
-
|
|
135
|
-
- name: Upload release assets
|
|
136
|
-
run: |
|
|
137
|
-
RELEASE_ID="${-{ steps.release.outputs.release_id }-}"
|
|
138
|
-
for artifact in{{#each releaseWorkflow.assetGlobs}} {{{this}}}{{/each}}; do
|
|
139
|
-
[ -f "$artifact" ] || continue
|
|
140
|
-
filename=$(basename "$artifact")
|
|
141
|
-
echo "Uploading $filename..."
|
|
142
|
-
curl -X POST -s \
|
|
143
|
-
-H "Authorization: token ${-{ secrets.GITHUB_TOKEN }-}" \
|
|
144
|
-
-H "Content-Type: application/octet-stream" \
|
|
145
|
-
--data-binary "@$artifact" \
|
|
146
|
-
"https://{{repository.host}}/api/v1/repos/{{repository.path}}/releases/$RELEASE_ID/assets?name=$filename"
|
|
147
|
-
done
|
|
148
|
-
|
|
149
|
-
- name: Release summary
|
|
150
|
-
run: |
|
|
151
|
-
echo "Release ${-{ steps.version.outputs.version }-} complete"
|
|
152
|
-
echo "Installation command:"
|
|
153
|
-
VERSION="${-{ steps.version.outputs.version }-}"
|
|
154
|
-
echo "curl -sSL {{{installer.releaseNotesInstallUrl}}} | sudo bash"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BaseFormatter } from '../classes.baseformatter.js';
|
|
2
|
-
import type { IFormatWarning, IPlannedChange } from '../interfaces.format.js';
|
|
3
|
-
/** The `minimumDependencyAge.exclude` entries that exempt every package of the owner scopes. */
|
|
4
|
-
export declare const ownerDependencyAgeExcludes: readonly string[];
|
|
5
|
-
/**
|
|
6
|
-
* Keeps Deno's minimum dependency age from holding back the owner's own packages: the root
|
|
7
|
-
* deno.json(c) of a Deno project gets `npm:<scope>/*` in `minimumDependencyAge.exclude` for every
|
|
8
|
-
* owner scope, and the owner's age when it sets none. Deno reads the setting from the workspace
|
|
9
|
-
* root only, so members are never written; a member that sets it is reported. Files that are
|
|
10
|
-
* not plain JSON are reported instead of rewritten, so their comments are never dropped.
|
|
11
|
-
*/
|
|
12
|
-
export declare class DenoFormatter extends BaseFormatter {
|
|
13
|
-
get name(): string;
|
|
14
|
-
analyze(): Promise<IPlannedChange[]>;
|
|
15
|
-
validate(): Promise<IFormatWarning[]>;
|
|
16
|
-
applyChange(change: IPlannedChange): Promise<void>;
|
|
17
|
-
private inspect;
|
|
18
|
-
}
|