@git.zone/cli 12.1.1 → 12.3.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/npm/.package.json +1 -1
- package/assets/templates/service/.package.json +1 -1
- package/assets/templates/wcc/.package.json +1 -1
- package/assets/templates/website/.package.json +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.tssea.d.ts +2 -7
- package/dist_ts/helpers.tssea.js +20 -10
- package/dist_ts/helpers.versionsource.d.ts +23 -5
- package/dist_ts/helpers.versionsource.js +115 -37
- package/dist_ts/helpers.workflow.d.ts +60 -17
- package/dist_ts/helpers.workflow.js +156 -51
- package/dist_ts/mod_config/index.js +98 -31
- package/dist_ts/mod_release/classes.releasejournal.d.ts +63 -8
- package/dist_ts/mod_release/classes.releasejournal.js +283 -124
- package/dist_ts/mod_release/helpers.cargorelease.d.ts +4 -3
- package/dist_ts/mod_release/helpers.cargorelease.js +5 -4
- package/dist_ts/mod_release/helpers.fossglobalassets.d.ts +61 -0
- package/dist_ts/mod_release/helpers.fossglobalassets.js +580 -0
- package/dist_ts/mod_release/helpers.giteaassets.d.ts +15 -51
- package/dist_ts/mod_release/helpers.giteaassets.js +40 -507
- package/dist_ts/mod_release/helpers.releaseassets.d.ts +40 -0
- package/dist_ts/mod_release/helpers.releaseassets.js +349 -0
- package/dist_ts/mod_release/helpers.releaseassettransfer.d.ts +67 -0
- package/dist_ts/mod_release/helpers.releaseassettransfer.js +239 -0
- package/dist_ts/mod_release/helpers.releasecheck.js +3 -2
- package/dist_ts/mod_release/helpers.releasepreparation.d.ts +7 -6
- package/dist_ts/mod_release/helpers.releasepreparation.js +34 -7
- package/dist_ts/mod_release/helpers.releasepublication.d.ts +8 -2
- package/dist_ts/mod_release/helpers.releasepublication.js +218 -54
- package/dist_ts/mod_release/helpers.releaseversionsource.d.ts +7 -5
- package/dist_ts/mod_release/helpers.releaseversionsource.js +9 -7
- package/dist_ts/mod_release/index.d.ts +1 -1
- package/dist_ts/mod_release/index.js +109 -68
- package/dist_ts/mod_release/interfaces.fossglobalassets.d.ts +108 -0
- package/dist_ts/mod_release/interfaces.fossglobalassets.js +2 -0
- package/dist_ts/mod_release/interfaces.giteaassets.d.ts +9 -43
- package/dist_ts/mod_release/interfaces.releaseassets.d.ts +68 -0
- package/dist_ts/mod_release/interfaces.releaseassets.js +2 -0
- package/dist_ts/plugins.d.ts +1 -0
- package/dist_ts/plugins.js +1 -1
- package/package.json +3 -2
- package/readme.md +339 -41
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.tssea.ts +31 -10
- package/ts/helpers.versionsource.ts +176 -45
- package/ts/helpers.workflow.ts +288 -78
- package/ts/mod_config/index.ts +130 -38
- package/ts/mod_release/classes.releasejournal.ts +499 -180
- package/ts/mod_release/helpers.cargorelease.ts +8 -3
- package/ts/mod_release/helpers.fossglobalassets.ts +886 -0
- package/ts/mod_release/helpers.giteaassets.ts +127 -694
- package/ts/mod_release/helpers.releaseassets.ts +516 -0
- package/ts/mod_release/helpers.releaseassettransfer.ts +339 -0
- package/ts/mod_release/helpers.releasecheck.ts +3 -1
- package/ts/mod_release/helpers.releasepreparation.ts +55 -12
- package/ts/mod_release/helpers.releasepublication.ts +351 -69
- package/ts/mod_release/helpers.releaseversionsource.ts +11 -7
- package/ts/mod_release/index.ts +151 -90
- package/ts/mod_release/interfaces.fossglobalassets.ts +127 -0
- package/ts/mod_release/interfaces.giteaassets.ts +14 -47
- package/ts/mod_release/interfaces.releaseassets.ts +96 -0
- package/ts/plugins.ts +3 -0
|
@@ -8,21 +8,25 @@ import {
|
|
|
8
8
|
import { RsrepoEngineClient } from "./helpers.rsrepoengine.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The version source of the release in `cwdArg`: package.json,
|
|
12
|
-
* workspace of projectType "rust"
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The version source of the release in `cwdArg`: package.json, the Cargo
|
|
12
|
+
* workspace of projectType "rust", or package.json together with the internal
|
|
13
|
+
* Cargo workspace of a TypeScript project that configures the cargo target;
|
|
14
|
+
* every Cargo workspace through the project's rsrepo engine. `gitzone
|
|
15
|
+
* release`, its plan and `gitzone release check` all open it here, so they
|
|
16
|
+
* refuse the same projects with the same message.
|
|
15
17
|
*/
|
|
16
18
|
export const openReleaseVersionSource = async (
|
|
17
19
|
smartshellArg: plugins.smartshell.Smartshell,
|
|
18
|
-
workflowArg: Pick<IResolvedReleaseWorkflow, "
|
|
20
|
+
workflowArg: Pick<IResolvedReleaseWorkflow, "cargoWorkspace">,
|
|
19
21
|
cwdArg: string,
|
|
20
22
|
): Promise<IVersionSource> => {
|
|
21
23
|
const kind = await detectVersionSourceKind(
|
|
22
24
|
cwdArg,
|
|
23
|
-
workflowArg.
|
|
25
|
+
workflowArg.cargoWorkspace === "root" ? "rust" : undefined,
|
|
26
|
+
workflowArg.cargoWorkspace === "internal",
|
|
24
27
|
);
|
|
25
|
-
if (kind !== "cargo"
|
|
28
|
+
if (kind !== "cargo" && kind !== "npm+cargo")
|
|
29
|
+
return openVersionSource(kind, cwdArg);
|
|
26
30
|
const engine = await RsrepoEngineClient.forProject(smartshellArg, cwdArg);
|
|
27
31
|
await engine.assertCapabilities(["plan", "set-version"]);
|
|
28
32
|
return openVersionSource(kind, cwdArg, engine);
|
package/ts/mod_release/index.ts
CHANGED
|
@@ -19,8 +19,11 @@ import {
|
|
|
19
19
|
resolveReleaseResumeConfiguration,
|
|
20
20
|
readReleaseRecordRetention,
|
|
21
21
|
assertGiteaAssetsGitDestination,
|
|
22
|
+
assertReleaseAssetsGitDestination,
|
|
23
|
+
releaseAssetTargetNames,
|
|
22
24
|
type IResolvedReleaseResumeConfiguration,
|
|
23
25
|
type IResolvedReleaseWorkflow,
|
|
26
|
+
type TReleaseCargoWorkspace,
|
|
24
27
|
type TResolvedReleaseDockerConfiguration,
|
|
25
28
|
} from "../helpers.workflow.js";
|
|
26
29
|
import type * as commitHelpers from "../mod_commit/mod.helpers.js";
|
|
@@ -67,6 +70,10 @@ import {
|
|
|
67
70
|
getReleaseCargoRegistries,
|
|
68
71
|
hasReleasePackages,
|
|
69
72
|
isVerificationOnlyResume,
|
|
73
|
+
assertReleaseAssetsResumeConfiguration,
|
|
74
|
+
getReleaseAssets,
|
|
75
|
+
type IReleaseJournalWithFossglobalAssets,
|
|
76
|
+
type IReleaseJournalWithGiteaAssets,
|
|
70
77
|
type IReleasePackage,
|
|
71
78
|
type IReleaseArtifact,
|
|
72
79
|
type TReleaseJournal,
|
|
@@ -80,10 +87,13 @@ import {
|
|
|
80
87
|
} from "./classes.releasejournal.js";
|
|
81
88
|
import { formatBytes } from "../mod_services/helpers.js";
|
|
82
89
|
import { createReleaseGitRemotePolicy } from "./helpers.gitremote.js";
|
|
90
|
+
import { GiteaAssetsClient } from "./helpers.giteaassets.js";
|
|
91
|
+
import { FossglobalAssetsClient } from "./helpers.fossglobalassets.js";
|
|
83
92
|
import {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
prepareReleaseAssets,
|
|
94
|
+
readReleaseAssetCredential,
|
|
95
|
+
releaseAssetTargets,
|
|
96
|
+
} from "./helpers.releaseassets.js";
|
|
87
97
|
import {
|
|
88
98
|
assertNoLegacyNpmPublisher,
|
|
89
99
|
assertNoStandaloneTspublishPublisher,
|
|
@@ -275,18 +285,23 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
275
285
|
workflow.giteaAssets,
|
|
276
286
|
branchContext.pushUrl || "",
|
|
277
287
|
);
|
|
288
|
+
if (workflow.fossglobalAssets)
|
|
289
|
+
assertReleaseAssetsGitDestination(
|
|
290
|
+
"fossglobalAssets",
|
|
291
|
+
workflow.fossglobalAssets,
|
|
292
|
+
branchContext.pushUrl || "",
|
|
293
|
+
);
|
|
278
294
|
const pending = await readPendingChangelog(
|
|
279
295
|
plugins.path.join(branchContext.sourceCwd, workflow.changelogFile),
|
|
280
296
|
workflow.changelogPendingSection,
|
|
281
297
|
);
|
|
298
|
+
const versionSource = await openReleaseVersionSource(
|
|
299
|
+
smartshellInstance,
|
|
300
|
+
workflow,
|
|
301
|
+
branchContext.sourceCwd,
|
|
302
|
+
);
|
|
282
303
|
const versionResolution = resolveReleaseVersion({
|
|
283
|
-
currentVersion: await (
|
|
284
|
-
await openReleaseVersionSource(
|
|
285
|
-
smartshellInstance,
|
|
286
|
-
workflow,
|
|
287
|
-
branchContext.sourceCwd,
|
|
288
|
-
)
|
|
289
|
-
).readCurrentVersion(),
|
|
304
|
+
currentVersion: await versionSource.readCurrentVersion(),
|
|
290
305
|
pendingChangelog: pending.block,
|
|
291
306
|
levelOverride: readReleaseLevelOverride(argvArg),
|
|
292
307
|
versionFloor: workflow.versionFloor,
|
|
@@ -313,6 +328,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
313
328
|
workflow,
|
|
314
329
|
branchContext,
|
|
315
330
|
versionResolution,
|
|
331
|
+
versionSource,
|
|
316
332
|
cargoPlan,
|
|
317
333
|
);
|
|
318
334
|
// The plan refuses what `assertCargoReleasePlan` refuses before a release
|
|
@@ -379,19 +395,25 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
379
395
|
}
|
|
380
396
|
if (workflow.giteaAssets) {
|
|
381
397
|
const { tokenEnv, manifestPath, ...destination } = workflow.giteaAssets;
|
|
382
|
-
const token = process.env[tokenEnv];
|
|
383
|
-
if (!token)
|
|
384
|
-
throw new Error(
|
|
385
|
-
`Gitea assets require the configured credential in ${tokenEnv}.`,
|
|
386
|
-
);
|
|
387
398
|
await new GiteaAssetsClient({
|
|
388
399
|
...workflow.giteaAssetTransfer,
|
|
389
400
|
destination,
|
|
390
401
|
tag: `v${newVersion}`,
|
|
391
402
|
commit: branchContext.sourceOid,
|
|
392
|
-
token,
|
|
403
|
+
token: readReleaseAssetCredential("giteaAssets", tokenEnv),
|
|
393
404
|
}).preflight();
|
|
394
405
|
}
|
|
406
|
+
// Before the tag exists, any release for it is someone else's.
|
|
407
|
+
if (workflow.fossglobalAssets) {
|
|
408
|
+
const { tokenEnv, manifestPath, ...destination } =
|
|
409
|
+
workflow.fossglobalAssets;
|
|
410
|
+
await new FossglobalAssetsClient({
|
|
411
|
+
...workflow.fossglobalAssetTransfer,
|
|
412
|
+
destination,
|
|
413
|
+
tag: `v${newVersion}`,
|
|
414
|
+
token: readReleaseAssetCredential("fossglobalAssets", tokenEnv),
|
|
415
|
+
}).preflight(null);
|
|
416
|
+
}
|
|
395
417
|
if (preflightTsdocker) {
|
|
396
418
|
await preflightTsdocker.validate(
|
|
397
419
|
createDockerQualificationRequest(
|
|
@@ -410,7 +432,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
410
432
|
smartshell: smartshellInstance,
|
|
411
433
|
cwd: branchContext.sourceCwd,
|
|
412
434
|
sourceOid: branchContext.sourceOid,
|
|
413
|
-
cargo: workflow.
|
|
435
|
+
cargo: workflow.cargoWorkspace,
|
|
414
436
|
});
|
|
415
437
|
}
|
|
416
438
|
|
|
@@ -550,6 +572,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
550
572
|
npmVerificationWindowMs: workflow.npmVerificationWindowMinutes * 60_000,
|
|
551
573
|
giteaAssetTransfer: workflow.giteaAssetTransfer,
|
|
552
574
|
giteaAssetConcurrency: workflow.giteaAssetConcurrency,
|
|
575
|
+
fossglobalAssetTransfer: workflow.fossglobalAssetTransfer,
|
|
553
576
|
gitRemotePolicy: branchContext.gitRemotePolicy,
|
|
554
577
|
tsdocker: journalContext.tsdocker,
|
|
555
578
|
...cargoPublicationOptions(
|
|
@@ -557,6 +580,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
557
580
|
releaseCwd,
|
|
558
581
|
releaseRefs.mainOid,
|
|
559
582
|
journalContext.cargoEngine,
|
|
583
|
+
workflow.cargoWorkspace,
|
|
560
584
|
workflow.cargo?.verificationWindowMinutes,
|
|
561
585
|
),
|
|
562
586
|
ensurePublicationState,
|
|
@@ -730,18 +754,19 @@ const assertReleaseConfiguration = (
|
|
|
730
754
|
workflowArg: IResolvedReleaseWorkflow,
|
|
731
755
|
mergeRequestedArg: boolean,
|
|
732
756
|
): void => {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
!workflowArg
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
757
|
+
for (const target of releaseAssetTargetNames) {
|
|
758
|
+
if (
|
|
759
|
+
workflowArg.targets.includes(target) &&
|
|
760
|
+
(!workflowArg[target] ||
|
|
761
|
+
!workflowArg.targets.includes("git") ||
|
|
762
|
+
!workflowArg.pushBranch ||
|
|
763
|
+
!workflowArg.pushTags ||
|
|
764
|
+
mergeRequestedArg)
|
|
765
|
+
)
|
|
766
|
+
throw new Error(
|
|
767
|
+
`${releaseAssetTargets[target].label} asset releases require integrated main and Git branch/tag publication.`,
|
|
768
|
+
);
|
|
769
|
+
}
|
|
745
770
|
if (workflowArg.targets.includes("docker")) {
|
|
746
771
|
if (mergeRequestedArg) {
|
|
747
772
|
throw new Error(
|
|
@@ -794,7 +819,7 @@ interface ICreateReleaseJournalOptions {
|
|
|
794
819
|
releaseCwd: string;
|
|
795
820
|
/**
|
|
796
821
|
* Exact disposable checkout of the release commit that every build output,
|
|
797
|
-
* npm tarball, and frozen
|
|
822
|
+
* npm tarball, and frozen release asset is taken from.
|
|
798
823
|
*/
|
|
799
824
|
npmSourceCwd?: string;
|
|
800
825
|
/**
|
|
@@ -921,31 +946,38 @@ interface IPreparedTaggedRelease {
|
|
|
921
946
|
|
|
922
947
|
/**
|
|
923
948
|
* What publication needs for a journal with crates: the engine, the index
|
|
924
|
-
* wait, and checkouts of the release commit to run `cargo publish` in
|
|
949
|
+
* wait, and checkouts of the release commit to run `cargo publish` in, which
|
|
950
|
+
* fetch the workspace the crates come from.
|
|
925
951
|
*/
|
|
926
952
|
const cargoPublicationOptions = (
|
|
927
953
|
smartshellArg: plugins.smartshell.Smartshell,
|
|
928
954
|
repositoryCwdArg: string,
|
|
929
955
|
mainOidArg: string,
|
|
930
956
|
engineArg: IRsrepoEngineClient | undefined,
|
|
957
|
+
workspaceArg: TReleaseCargoWorkspace | undefined,
|
|
931
958
|
verificationWindowMinutesArg: number | undefined,
|
|
932
959
|
): Pick<
|
|
933
960
|
IReleasePublicationOptions,
|
|
934
961
|
"cargoEngine" | "cargoVerificationWindowMs" | "withCargoPublishCheckout"
|
|
935
|
-
> =>
|
|
936
|
-
engineArg
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
962
|
+
> => {
|
|
963
|
+
if (!engineArg) return {};
|
|
964
|
+
if (!workspaceArg)
|
|
965
|
+
throw new Error(
|
|
966
|
+
"Cargo publication requires the configured Cargo workspace of the release.",
|
|
967
|
+
);
|
|
968
|
+
return {
|
|
969
|
+
cargoEngine: engineArg,
|
|
970
|
+
...(verificationWindowMinutesArg !== undefined
|
|
971
|
+
? { cargoVerificationWindowMs: verificationWindowMinutesArg * 60_000 }
|
|
972
|
+
: {}),
|
|
973
|
+
withCargoPublishCheckout: createCargoPublishCheckout(
|
|
974
|
+
smartshellArg,
|
|
975
|
+
repositoryCwdArg,
|
|
976
|
+
mainOidArg,
|
|
977
|
+
workspaceArg,
|
|
978
|
+
),
|
|
979
|
+
};
|
|
980
|
+
};
|
|
949
981
|
|
|
950
982
|
/**
|
|
951
983
|
* Everything between the release tag and the installed journal: the Docker
|
|
@@ -1006,7 +1038,7 @@ const prepareTaggedRelease = async (
|
|
|
1006
1038
|
mainOid: optionsArg.refs.mainOid,
|
|
1007
1039
|
// Preflight already ran the configured tests on this exact source.
|
|
1008
1040
|
...(workflow.runBuild ? { buildCommand: workflow.buildCommand } : {}),
|
|
1009
|
-
cargo: workflow.
|
|
1041
|
+
cargo: workflow.cargoWorkspace,
|
|
1010
1042
|
},
|
|
1011
1043
|
async (checkout) =>
|
|
1012
1044
|
createReleaseJournal({
|
|
@@ -1276,19 +1308,28 @@ export const createReleaseJournal = async (
|
|
|
1276
1308
|
}
|
|
1277
1309
|
const now = new Date().toISOString();
|
|
1278
1310
|
const gitStatus = createInitialTargetStatus(gitEnabled);
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1311
|
+
// The release asset target's section: its destination, credential
|
|
1312
|
+
// variable and manifest, and the frozen copy of every listed asset.
|
|
1313
|
+
const assetTarget = releaseAssetTargetNames.find((targetArg) =>
|
|
1314
|
+
optionsArg.workflow.targets.includes(targetArg),
|
|
1315
|
+
);
|
|
1316
|
+
let assetSection:
|
|
1317
|
+
| Pick<IReleaseJournalWithGiteaAssets, "giteaAssets">
|
|
1318
|
+
| Pick<IReleaseJournalWithFossglobalAssets, "fossglobalAssets">
|
|
1282
1319
|
| undefined;
|
|
1283
|
-
if (
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1320
|
+
if (assetTarget) {
|
|
1321
|
+
const assetConfiguration = optionsArg.workflow[assetTarget];
|
|
1322
|
+
if (!assetConfiguration || !gitEnabled)
|
|
1323
|
+
throw new Error(
|
|
1324
|
+
`Invalid ${releaseAssetTargets[assetTarget].label} asset target combination.`,
|
|
1325
|
+
);
|
|
1326
|
+
assertReleaseAssetsGitDestination(
|
|
1327
|
+
assetTarget,
|
|
1287
1328
|
assetConfiguration,
|
|
1288
1329
|
optionsArg.releasePushUrl!,
|
|
1289
1330
|
);
|
|
1290
1331
|
const { tokenEnv, manifestPath, ...destination } = assetConfiguration;
|
|
1291
|
-
const assets = await
|
|
1332
|
+
const assets = await prepareReleaseAssets(assetTarget, {
|
|
1292
1333
|
repositoryRoot: npmSourceCwd,
|
|
1293
1334
|
manifestPath,
|
|
1294
1335
|
version: optionsArg.version,
|
|
@@ -1296,24 +1337,40 @@ export const createReleaseJournal = async (
|
|
|
1296
1337
|
artifactDirectory: temporaryDirectory,
|
|
1297
1338
|
destination,
|
|
1298
1339
|
});
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1340
|
+
const frame = { destination, tokenEnv, manifestPath };
|
|
1341
|
+
assetSection =
|
|
1342
|
+
assetTarget === "giteaAssets"
|
|
1343
|
+
? {
|
|
1344
|
+
giteaAssets: {
|
|
1345
|
+
...frame,
|
|
1346
|
+
release: { ...createInitialTargetStatus(true), id: null },
|
|
1347
|
+
assets: assets.map((asset) => ({
|
|
1348
|
+
...createInitialTargetStatus(true),
|
|
1349
|
+
asset,
|
|
1350
|
+
})),
|
|
1351
|
+
},
|
|
1352
|
+
}
|
|
1353
|
+
: {
|
|
1354
|
+
fossglobalAssets: {
|
|
1355
|
+
...frame,
|
|
1356
|
+
release: { ...createInitialTargetStatus(true), releaseId: null },
|
|
1357
|
+
assets: assets.map((asset) => ({
|
|
1358
|
+
...createInitialTargetStatus(true),
|
|
1359
|
+
asset,
|
|
1360
|
+
assetId: null,
|
|
1361
|
+
})),
|
|
1362
|
+
},
|
|
1363
|
+
};
|
|
1309
1364
|
}
|
|
1310
1365
|
const journal = finalizeJournalCompletion(
|
|
1311
1366
|
{
|
|
1312
1367
|
kind: "gitzone-release-journal",
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1368
|
+
// A Docker release carries its release asset section in schema 2;
|
|
1369
|
+
// schema 4 is a release with assets and without Docker.
|
|
1370
|
+
schemaVersion: optionsArg.dockerRequest
|
|
1371
|
+
? 2
|
|
1372
|
+
: assetSection
|
|
1373
|
+
? 4
|
|
1317
1374
|
: packages.length
|
|
1318
1375
|
? 3
|
|
1319
1376
|
: 1,
|
|
@@ -1339,7 +1396,9 @@ export const createReleaseJournal = async (
|
|
|
1339
1396
|
: {}),
|
|
1340
1397
|
},
|
|
1341
1398
|
artifact,
|
|
1342
|
-
...(packages.length ||
|
|
1399
|
+
...(packages.length || (assetSection && !optionsArg.dockerRequest)
|
|
1400
|
+
? { packages }
|
|
1401
|
+
: {}),
|
|
1343
1402
|
git: {
|
|
1344
1403
|
state: gitStatus.state,
|
|
1345
1404
|
attempts: gitStatus.attempts,
|
|
@@ -1386,7 +1445,7 @@ export const createReleaseJournal = async (
|
|
|
1386
1445
|
: [],
|
|
1387
1446
|
},
|
|
1388
1447
|
...(cargo ? { cargo } : {}),
|
|
1389
|
-
...
|
|
1448
|
+
...assetSection,
|
|
1390
1449
|
...(optionsArg.dockerRequest
|
|
1391
1450
|
? {
|
|
1392
1451
|
docker: createInitialReleaseDockerJournal(
|
|
@@ -1863,6 +1922,7 @@ const runReleaseRecover = async (
|
|
|
1863
1922
|
npmVerificationWindowMs: workflow.npmVerificationWindowMinutes * 60_000,
|
|
1864
1923
|
giteaAssetTransfer: workflow.giteaAssetTransfer,
|
|
1865
1924
|
giteaAssetConcurrency: workflow.giteaAssetConcurrency,
|
|
1925
|
+
fossglobalAssetTransfer: workflow.fossglobalAssetTransfer,
|
|
1866
1926
|
gitRemotePolicy: branch.gitRemotePolicy,
|
|
1867
1927
|
tsdocker,
|
|
1868
1928
|
ensurePublicationState: ensureState,
|
|
@@ -2014,7 +2074,7 @@ const runReleaseResumeFromStore = async (optionsArg: {
|
|
|
2014
2074
|
const resumeConfiguration = await resolveReleaseResumeConfiguration({
|
|
2015
2075
|
git: gitEnabled,
|
|
2016
2076
|
npm: journal.npm.registries.length > 0,
|
|
2017
|
-
|
|
2077
|
+
assetTarget: getReleaseAssets(journal)?.target,
|
|
2018
2078
|
cargo: journalCargo !== undefined,
|
|
2019
2079
|
});
|
|
2020
2080
|
await assertResumeConfiguration(resumeConfiguration, journal, paths.cwd);
|
|
@@ -2152,6 +2212,7 @@ const runReleaseResumeFromStore = async (optionsArg: {
|
|
|
2152
2212
|
resumeConfiguration.npmVerificationWindowMinutes * 60_000,
|
|
2153
2213
|
giteaAssetTransfer: resumeConfiguration.giteaAssetTransfer,
|
|
2154
2214
|
giteaAssetConcurrency: resumeConfiguration.giteaAssetConcurrency,
|
|
2215
|
+
fossglobalAssetTransfer: resumeConfiguration.fossglobalAssetTransfer,
|
|
2155
2216
|
gitRemotePolicy: branchContext.gitRemotePolicy,
|
|
2156
2217
|
tsdocker,
|
|
2157
2218
|
...cargoPublicationOptions(
|
|
@@ -2159,6 +2220,7 @@ const runReleaseResumeFromStore = async (optionsArg: {
|
|
|
2159
2220
|
paths.cwd,
|
|
2160
2221
|
journal.release.mainOid,
|
|
2161
2222
|
cargoEngine,
|
|
2223
|
+
resumeConfiguration.cargoWorkspace,
|
|
2162
2224
|
resumeConfiguration.cargo?.verificationWindowMinutes,
|
|
2163
2225
|
),
|
|
2164
2226
|
ensurePublicationState,
|
|
@@ -2248,17 +2310,7 @@ const assertResumeConfiguration = async (
|
|
|
2248
2310
|
"Current cargo release registries do not match the journal.",
|
|
2249
2311
|
);
|
|
2250
2312
|
}
|
|
2251
|
-
|
|
2252
|
-
const { destination, tokenEnv, manifestPath } = journalArg.giteaAssets;
|
|
2253
|
-
if (
|
|
2254
|
-
JSON.stringify(workflowArg.giteaAssets) !==
|
|
2255
|
-
JSON.stringify({ ...destination, tokenEnv, manifestPath })
|
|
2256
|
-
) {
|
|
2257
|
-
throw new Error(
|
|
2258
|
-
"Current Gitea asset configuration does not match the journal.",
|
|
2259
|
-
);
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2313
|
+
assertReleaseAssetsResumeConfiguration(workflowArg, journalArg);
|
|
2262
2314
|
if (
|
|
2263
2315
|
journalArg.git.state !== "skipped" ||
|
|
2264
2316
|
getReleaseArtifacts(journalArg).length
|
|
@@ -2313,9 +2365,13 @@ const printReleaseJournalSummary = (journalArg: TReleaseJournal): void => {
|
|
|
2313
2365
|
for (const cell of cargo?.registries ?? []) {
|
|
2314
2366
|
console.log(`cargo ${cell.crate} ${cell.registry}: ${cell.state}`);
|
|
2315
2367
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2368
|
+
const releaseAssets = getReleaseAssets(journalArg);
|
|
2369
|
+
if (releaseAssets) {
|
|
2370
|
+
const { release, assets } = releaseAssets.section;
|
|
2371
|
+
console.log(
|
|
2372
|
+
`${releaseAssetTargets[releaseAssets.target].label} release: ${release.state}`,
|
|
2373
|
+
);
|
|
2374
|
+
for (const entry of assets)
|
|
2319
2375
|
console.log(
|
|
2320
2376
|
`asset ${entry.asset.name}: ${entry.state} (${entry.asset.sha256})`,
|
|
2321
2377
|
);
|
|
@@ -2900,6 +2956,7 @@ async function printReleasePlan(
|
|
|
2900
2956
|
workflow: IResolvedReleaseWorkflow,
|
|
2901
2957
|
branchContextArg: IReleaseBranchContext,
|
|
2902
2958
|
versionResolutionArg: IReleaseVersionResolution,
|
|
2959
|
+
versionSourceArg: IVersionSource,
|
|
2903
2960
|
cargoPlanArg?: IRsrepoPlanResult,
|
|
2904
2961
|
): Promise<void> {
|
|
2905
2962
|
console.log("");
|
|
@@ -2939,6 +2996,9 @@ async function printReleasePlan(
|
|
|
2939
2996
|
for (const line of describeReleaseVersion(versionResolutionArg)) {
|
|
2940
2997
|
console.log(line);
|
|
2941
2998
|
}
|
|
2999
|
+
console.log(
|
|
3000
|
+
`version source: ${await versionSourceArg.describeCurrentVersions()}`,
|
|
3001
|
+
);
|
|
2942
3002
|
if (workflow.targets.includes("npm")) {
|
|
2943
3003
|
console.log(
|
|
2944
3004
|
`npm registries: ${workflow.npmRegistries.length > 0 ? workflow.npmRegistries.join(", ") : "none"}`,
|
|
@@ -2962,10 +3022,11 @@ async function printReleasePlan(
|
|
|
2962
3022
|
for (const line of describeCargoReleasePlan(cargoPlanArg, workflow.cargo))
|
|
2963
3023
|
console.log(line);
|
|
2964
3024
|
}
|
|
2965
|
-
|
|
2966
|
-
const assets = workflow
|
|
3025
|
+
for (const target of releaseAssetTargetNames) {
|
|
3026
|
+
const assets = workflow[target];
|
|
3027
|
+
if (!assets) continue;
|
|
2967
3028
|
console.log(
|
|
2968
|
-
|
|
3029
|
+
`${releaseAssetTargets[target].label} assets: ${assets.apiOrigin}/${assets.owner}/${assets.repository}`,
|
|
2969
3030
|
);
|
|
2970
3031
|
console.log(`asset manifest: ${assets.manifestPath}`);
|
|
2971
3032
|
console.log(`asset credential variable: ${assets.tokenEnv}`);
|
|
@@ -3095,7 +3156,7 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
3095
3156
|
{
|
|
3096
3157
|
flag: "--target <names>",
|
|
3097
3158
|
description:
|
|
3098
|
-
"Replace configured targets with a non-empty subset of git,giteaAssets,npm,cargo,docker",
|
|
3159
|
+
"Replace configured targets with a non-empty subset of git,giteaAssets,fossglobalAssets,npm,cargo,docker",
|
|
3099
3160
|
},
|
|
3100
3161
|
{ flag: "--npm", description: "Explicitly select the npm target" },
|
|
3101
3162
|
{
|
|
@@ -3179,7 +3240,7 @@ export function showHelp(mode?: ICliMode): void {
|
|
|
3179
3240
|
console.log(" --no-build Disable the post-metadata release build");
|
|
3180
3241
|
console.log(" -p, --push Explicitly select the git target");
|
|
3181
3242
|
console.log(
|
|
3182
|
-
" --target <names> Replace configured targets with a non-empty subset of git,giteaAssets,npm,cargo,docker",
|
|
3243
|
+
" --target <names> Replace configured targets with a non-empty subset of git,giteaAssets,fossglobalAssets,npm,cargo,docker",
|
|
3183
3244
|
);
|
|
3184
3245
|
console.log(" --npm Explicitly select the npm target");
|
|
3185
3246
|
console.log(
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IReleaseAssetDestination,
|
|
3
|
+
IReleaseAssetTransferLimits,
|
|
4
|
+
IReleaseFrozenAsset,
|
|
5
|
+
} from "./interfaces.releaseassets.js";
|
|
6
|
+
|
|
7
|
+
export interface IFossglobalAssetsClientOptions extends Partial<IReleaseAssetTransferLimits> {
|
|
8
|
+
destination: IReleaseAssetDestination;
|
|
9
|
+
tag: string;
|
|
10
|
+
/**
|
|
11
|
+
* An `fgu_` user access token with write access to the repository. It is
|
|
12
|
+
* sent as a bearer token to `destination.apiOrigin` only, never along a
|
|
13
|
+
* redirect, and never appears in a message.
|
|
14
|
+
*/
|
|
15
|
+
token: string;
|
|
16
|
+
fetchImplementation?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A frozen asset with the code host's id for it, once one was recorded. */
|
|
20
|
+
export interface IFossglobalClaimedAsset {
|
|
21
|
+
asset: IReleaseFrozenAsset;
|
|
22
|
+
/** Recorded from the upload's 201 or an inspection; null before that. */
|
|
23
|
+
assetId: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* What this release owns at the destination, as its journal records it. Every
|
|
28
|
+
* inspection holds the code host's release for the tag against it.
|
|
29
|
+
*/
|
|
30
|
+
export interface IFossglobalReleaseClaim {
|
|
31
|
+
/** The annotated tag object the release must target (the journal's `tagOid`). */
|
|
32
|
+
tagObjectId: string;
|
|
33
|
+
/** Recorded from the create's 201 or an inspection; null before that. */
|
|
34
|
+
releaseId: string | null;
|
|
35
|
+
/** The frozen asset set in manifest order. */
|
|
36
|
+
assets: readonly IFossglobalClaimedAsset[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The release for the tag as the code host lists it, once proven to be this release's. */
|
|
40
|
+
export interface IFossglobalRelease {
|
|
41
|
+
releaseId: string;
|
|
42
|
+
/** A draft's assets are served to nobody; publication makes them public. */
|
|
43
|
+
draft: boolean;
|
|
44
|
+
/** The release's page on the code host's website; printed, never validated. */
|
|
45
|
+
htmlUrl: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A frozen asset the code host lists with the frozen size and SHA-256. */
|
|
49
|
+
export interface IFossglobalPresentAsset {
|
|
50
|
+
asset: IReleaseFrozenAsset;
|
|
51
|
+
assetId: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface IFossglobalAssetInspection {
|
|
55
|
+
release: IFossglobalRelease;
|
|
56
|
+
present: IFossglobalPresentAsset[];
|
|
57
|
+
missing: IReleaseFrozenAsset[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The code host's native release API for one release. Every read is the
|
|
62
|
+
* authenticated release list; a release is addressed by its tag. No method
|
|
63
|
+
* retries, sleeps or follows a redirect, and outcomes are classified by status
|
|
64
|
+
* code and list state, never by message text. The release journal owns
|
|
65
|
+
* attempt admission.
|
|
66
|
+
*/
|
|
67
|
+
export interface IFossglobalAssetsClient {
|
|
68
|
+
/**
|
|
69
|
+
* Proves the token, read access and an active native repository through the
|
|
70
|
+
* release list, and that no release of anyone else holds the tag. With no
|
|
71
|
+
* claim (before the journal exists) any release for the tag is foreign.
|
|
72
|
+
*/
|
|
73
|
+
preflight(claim: IFossglobalReleaseClaim | null): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* The release for the tag, or null when there is none. The release with the
|
|
76
|
+
* recorded id counts as this release's in either draft state; with no id
|
|
77
|
+
* recorded only a draft of the tag object holding frozen assets alone is,
|
|
78
|
+
* the one a crash between its create and the journal write left behind.
|
|
79
|
+
* Anything else is a destination conflict.
|
|
80
|
+
*/
|
|
81
|
+
inspectRelease(
|
|
82
|
+
claim: IFossglobalReleaseClaim,
|
|
83
|
+
): Promise<IFossglobalRelease | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates the release for the tag as a draft. The code host resolves the
|
|
86
|
+
* tag itself. A 409 or 503 is inconclusive; the next inspection decides.
|
|
87
|
+
*/
|
|
88
|
+
createRelease(claim: IFossglobalReleaseClaim): Promise<IFossglobalRelease>;
|
|
89
|
+
/**
|
|
90
|
+
* Classifies every listed asset of the recorded release: a frozen name with
|
|
91
|
+
* the frozen size and SHA-256 (and the recorded id) is present, anything
|
|
92
|
+
* else a destination conflict.
|
|
93
|
+
*/
|
|
94
|
+
inspectAssets(
|
|
95
|
+
claim: IFossglobalReleaseClaim,
|
|
96
|
+
): Promise<IFossglobalAssetInspection>;
|
|
97
|
+
/**
|
|
98
|
+
* Streams one frozen asset into the recorded draft with a fixed
|
|
99
|
+
* `Content-Length`. Its 201 must carry the frozen size and SHA-256, else a
|
|
100
|
+
* destination conflict; a 409 for a name the list does not show (an upload
|
|
101
|
+
* the code host never finished still holds it) and a 503 are inconclusive.
|
|
102
|
+
* Nothing is uploaded into a published release: one published without all
|
|
103
|
+
* of its frozen assets stops with a FossglobalReleaseStateChangedError
|
|
104
|
+
* before any byte is sent.
|
|
105
|
+
*/
|
|
106
|
+
uploadAsset(
|
|
107
|
+
claim: IFossglobalReleaseClaim,
|
|
108
|
+
asset: IReleaseFrozenAsset,
|
|
109
|
+
artifactDirectory: string,
|
|
110
|
+
): Promise<IFossglobalPresentAsset>;
|
|
111
|
+
/**
|
|
112
|
+
* The complete frozen set, nothing else, every recorded id unchanged. A
|
|
113
|
+
* release published without all of its frozen assets, nothing foreign
|
|
114
|
+
* listed, is a FossglobalReleaseStateChangedError: not terminal, since
|
|
115
|
+
* setting it back to draft keeps its id and lets a resume complete it.
|
|
116
|
+
*/
|
|
117
|
+
verifyComplete(claim: IFossglobalReleaseClaim): Promise<IFossglobalRelease>;
|
|
118
|
+
/**
|
|
119
|
+
* Publishes the complete draft (`draft: false`), then proves each frozen
|
|
120
|
+
* asset's anonymous availability by a HEAD of its frozen URL: 200, identity
|
|
121
|
+
* encoding, `Content-Length`, `X-Release-Asset-SHA256` and `ETag` all of
|
|
122
|
+
* the frozen asset. A 409 or 503 on the update is inconclusive; a release
|
|
123
|
+
* the inspection shows published with exactly the frozen set is verified,
|
|
124
|
+
* one published without all of it a FossglobalReleaseStateChangedError.
|
|
125
|
+
*/
|
|
126
|
+
publishRelease(claim: IFossglobalReleaseClaim): Promise<void>;
|
|
127
|
+
}
|