@adea-ai/app-framework 0.39.3 → 0.40.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/README.md +160 -53
- package/dist/app/application.d.ts +0 -1
- package/dist/app/application.js +8 -6
- package/dist/app/create-application.js +3 -11
- package/dist/app/service-registry.d.ts +0 -1
- package/dist/app/service-registry.js +3 -3
- package/dist/app/value-guards.d.ts +2 -0
- package/dist/app/value-guards.js +6 -1
- package/dist/appearance/appearance-host.d.ts +1 -1
- package/dist/appearance/appearance-host.js +11 -2
- package/dist/appearance/appearance-preferences.d.ts +0 -1
- package/dist/appearance/custom-theme-import.d.ts +8 -2
- package/dist/appearance/custom-theme-import.js +58 -23
- package/dist/appearance/custom-theme-library.d.ts +3 -3
- package/dist/appearance/custom-theme-library.js +3 -3
- package/dist/appearance/theme-file-importer.d.ts +1 -1
- package/dist/appearance/theme-file-importer.js +2 -1
- package/dist/appearance/theme-library-mutation.d.ts +7 -0
- package/dist/appearance/theme-library-mutation.js +10 -2
- package/dist/appearance/theme-library-store.d.ts +17 -13
- package/dist/appearance/theme-library-store.js +35 -22
- package/dist/appearance/theme-record-adapter.js +1 -2
- package/dist/appearance/theme-registry.js +0 -1
- package/dist/cli/cli-runner.d.ts +3 -2
- package/dist/cli/cli-runner.js +5 -10
- package/dist/cli/release-assets-plan-cli.js +2 -2
- package/dist/cli/release-cut-cli.js +2 -3
- package/dist/cli/release-descriptor-staging-cli.js +2 -2
- package/dist/cli/release-finalize-cli.js +3 -3
- package/dist/cli/release-promote-cli.js +2 -2
- package/dist/cli/release-publish-cli.js +2 -2
- package/dist/cli/release-sign-cli.js +2 -1
- package/dist/cli/release-step-cli.js +2 -2
- package/dist/desktop/channel-proof.js +27 -11
- package/dist/desktop/client-assets.d.ts +6 -1
- package/dist/desktop/client-assets.js +16 -3
- package/dist/desktop/client-dev-proxy.d.ts +0 -2
- package/dist/desktop/client-dev-proxy.js +2 -2
- package/dist/desktop/desktop-client.js +2 -1
- package/dist/desktop/desktop-gateway.js +24 -82
- package/dist/desktop/desktop-host-websocket.d.ts +5 -1
- package/dist/desktop/desktop-host-websocket.js +9 -7
- package/dist/desktop/desktop-host.d.ts +5 -0
- package/dist/desktop/desktop-host.js +3 -0
- package/dist/desktop/desktop-stream.js +5 -10
- package/dist/desktop/typed-array-intrinsics.d.ts +6 -0
- package/dist/desktop/typed-array-intrinsics.js +13 -1
- package/dist/developer-app/developer-app.d.ts +1 -1
- package/dist/developer-app/developer-app.js +26 -13
- package/dist/framework-source.json +1 -1
- package/dist/installer/command-artifact.d.ts +1 -0
- package/dist/installer/command-artifact.js +47 -27
- package/dist/installer/installed-payload.js +3 -1
- package/dist/installer/installer-ci-bootstrap.js +5 -6
- package/dist/installer/installer-ci-preflight.js +3 -3
- package/dist/installer/installer-identity.d.ts +0 -22
- package/dist/installer/installer-identity.js +3 -53
- package/dist/installer/installer-image-mount.d.ts +0 -1
- package/dist/installer/installer-image-mount.js +1 -1
- package/dist/installer/installer-observation.d.ts +5 -5
- package/dist/installer/installer-observation.js +32 -47
- package/dist/installer/installer-process-cleanup.js +2 -2
- package/dist/installer/installer-renderer-evidence.js +7 -28
- package/dist/installer/installer-upgrade-command.js +8 -20
- package/dist/installer/installer-worker-guard.js +3 -3
- package/dist/native/cef-helper.js +4 -4
- package/dist/native/desktop-build.d.ts +0 -3
- package/dist/native/desktop-build.js +2 -2
- package/dist/native/electrobun-source-patch.d.ts +4 -0
- package/dist/native/electrobun-source-patch.js +5 -1
- package/dist/native/native-utilities.js +4 -3
- package/dist/native/pinned-download.d.ts +16 -0
- package/dist/native/pinned-download.js +42 -0
- package/dist/native/posix-launcher-build.js +15 -35
- package/dist/native/posix-tree-removal.js +21 -33
- package/dist/native/sidecar-services.d.ts +0 -2
- package/dist/native/sidecar-services.js +1 -1
- package/dist/native/sidecar.d.ts +3 -0
- package/dist/native/sidecar.js +15 -2
- package/dist/native/window-surface-store.js +3 -3
- package/dist/native/windows-extractor-build.d.ts +6 -16
- package/dist/native/windows-extractor-build.js +11 -14
- package/dist/release/feed-release-cut.d.ts +2 -6
- package/dist/release/feed-release-cut.js +5 -93
- package/dist/release/feed-state.js +1 -5
- package/dist/release/github-release-cut.js +5 -66
- package/dist/release/github-release-provenance.d.ts +2 -0
- package/dist/release/github-release-provenance.js +4 -7
- package/dist/release/github-release-publisher.js +2 -2
- package/dist/release/github-release-qualification.js +3 -3
- package/dist/release/local-release.d.ts +3 -3
- package/dist/release/local-release.js +12 -23
- package/dist/release/qualification-run.js +1 -1
- package/dist/release/release-assets-plan.js +1 -1
- package/dist/release/release-config.d.ts +7 -15
- package/dist/release/release-config.js +25 -29
- package/dist/release/release-cut-command.d.ts +1 -1
- package/dist/release/release-cut-command.js +1 -1
- package/dist/release/release-cut.d.ts +5 -32
- package/dist/release/release-cut.js +9 -55
- package/dist/release/release-descriptor-staging.js +3 -8
- package/dist/release/release-promotion.js +2 -1
- package/dist/release/release-publish-command.js +5 -15
- package/dist/release/release-qualification.js +1 -1
- package/dist/shared/bounded-body.d.ts +33 -0
- package/dist/shared/bounded-body.js +102 -0
- package/dist/shared/file-system.d.ts +12 -0
- package/dist/shared/file-system.js +40 -0
- package/dist/shell/app-shell.js +29 -14
- package/dist/shell/app-utilities.d.ts +4 -1
- package/dist/shell/app-utilities.js +5 -1
- package/dist/shell/application-menu.d.ts +1 -1
- package/dist/shell/application-menu.js +7 -3
- package/dist/shell/poll.d.ts +27 -0
- package/dist/shell/poll.js +88 -0
- package/dist/update-helper.bundle.js +268 -144
- package/dist/updates/channel-update-manager.js +0 -1
- package/dist/updates/desktop-updater.d.ts +9 -0
- package/dist/updates/desktop-updater.js +103 -50
- package/dist/updates/feed/release-feed.d.ts +7 -4
- package/dist/updates/feed/release-feed.js +3 -7
- package/dist/updates/feed/release-location.js +6 -26
- package/dist/updates/feed/release-version.d.ts +7 -2
- package/dist/updates/feed/release-version.js +9 -2
- package/dist/updates/feed/signed-release.d.ts +1 -1
- package/dist/updates/feed/signed-release.js +2 -2
- package/dist/updates/feed/update-discovery.js +2 -6
- package/dist/updates/helper/launch-gate-recovery.js +28 -78
- package/dist/updates/helper/resume-staging.d.ts +14 -3
- package/dist/updates/helper/resume-staging.js +23 -37
- package/dist/updates/helper/update-helper.d.ts +6 -2
- package/dist/updates/helper/update-helper.js +38 -33
- package/dist/updates/helper/update-resume.js +9 -6
- package/dist/updates/install/update-extraction.js +28 -8
- package/dist/updates/install/update-handoff-plan.d.ts +0 -1
- package/dist/updates/install/update-handoff-plan.js +3 -4
- package/dist/updates/install/update-swap-stage.js +1 -6
- package/dist/updates/install/update-swap.d.ts +5 -2
- package/dist/updates/install/update-swap.js +193 -72
- package/dist/updates/launch/helper-exit-wait.d.ts +6 -0
- package/dist/updates/launch/helper-exit-wait.js +18 -0
- package/dist/updates/launch/packaged-update-startup.js +8 -6
- package/dist/updates/launch/update-launch-gate.js +7 -14
- package/dist/updates/locks/stable-file.js +4 -1
- package/dist/updates/locks/update-helper-presence.d.ts +12 -0
- package/dist/updates/locks/update-helper-presence.js +27 -0
- package/dist/updates/retention/retention-cleanup.js +10 -9
- package/dist/updates/retention/retention-maintenance.d.ts +40 -0
- package/dist/updates/retention/retention-maintenance.js +95 -0
- package/dist/updates/retention/retention-prune-progress.js +4 -5
- package/dist/updates/retention/retirement-inventory.d.ts +13 -0
- package/dist/updates/retention/retirement-inventory.js +39 -31
- package/dist/updates/retention/retirement-records.d.ts +1 -4
- package/dist/updates/retention/retirement-records.js +18 -32
- package/dist/updates/retention/update-retention-marker.d.ts +4 -0
- package/dist/updates/retention/update-retention-marker.js +9 -14
- package/dist/updates/retention/update-retirement.d.ts +12 -0
- package/dist/updates/retention/update-retirement.js +59 -31
- package/dist/updates/update-adapter.d.ts +1 -23
- package/dist/updates/update-adapter.js +31 -24
- package/dist/updates/update-channel-store.d.ts +2 -1
- package/dist/updates/update-channel-store.js +6 -4
- package/dist/updates/update-manager.js +2 -2
- package/dist/updates/update-services.d.ts +1 -1
- package/dist/updates/update-services.js +9 -4
- package/dist/updates/update-state-store.d.ts +0 -2
- package/dist/updates/update-state-store.js +5 -12
- package/dist/updates/update-state.d.ts +6 -10
- package/dist/updates/update-state.js +1 -1
- package/dist/views/app-help.d.ts +1 -1
- package/dist/views/app-help.js +1 -3
- package/dist/views/appearance-surface.js +15 -8
- package/dist/views/update-surface.d.ts +1 -3
- package/dist/views/update-surface.js +2 -2
- package/package.json +20 -18
- package/src/app/application.tsx +13 -6
- package/src/appearance/appearance-host.tsx +17 -7
- package/src/appearance/appearance-preferences.ts +0 -1
- package/src/appearance/custom-theme-import.ts +99 -26
- package/src/appearance/custom-theme-library.ts +3 -2
- package/src/appearance/theme-file-importer.ts +3 -2
- package/src/appearance/theme-library-mutation.ts +20 -8
- package/src/appearance/theme-library-schema.ts +7 -0
- package/src/appearance/theme-library-store.ts +41 -26
- package/src/desktop/client-assets.ts +27 -12
- package/src/shell/app-shell.tsx +33 -13
- package/src/shell/app-utilities.tsx +10 -1
- package/src/shell/poll.ts +125 -0
- package/src/updates/feed/release-version.ts +11 -3
- package/src/updates/update-adapter.ts +27 -44
- package/src/updates/update-state.ts +7 -13
- package/src/views/app-help.tsx +1 -1
- package/src/views/appearance-surface.tsx +36 -8
- package/src/views/update-surface.tsx +0 -4
- package/templates/application/.github/workflows/release-assets.yml +2 -2
- package/templates/application/README.md +3 -3
- package/dist/native/cef-helper-download.d.ts +0 -1
- package/dist/native/cef-helper-download.js +0 -35
- package/src/desktop/client-response-lifecycle.ts +0 -305
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { ELECTROBUN_VERSION, ZIG_VERSION } from './electrobun-source-patch';
|
|
2
|
+
import { type PinnedFetch } from './pinned-download';
|
|
3
|
+
export { ELECTROBUN_VERSION, ZIG_VERSION };
|
|
1
4
|
/**
|
|
2
5
|
* Electrobun 2.0.5's Windows installer runs `extractor.exe`, whose shortcut code this
|
|
3
6
|
* framework patches (electrobun-windows-shortcut-com.patch). A stable Windows build
|
|
4
7
|
* rebuilds that extractor from the pinned source with the pinned Zig toolchain and points
|
|
5
8
|
* Electrobun at a copy of its devkit holding the rebuilt binary.
|
|
6
9
|
*/
|
|
7
|
-
export declare const ELECTROBUN_VERSION = "2.0.5";
|
|
8
|
-
/** The Zig release Electrobun 2.0.5 builds with (its src/shared/build-dependencies.ts). */
|
|
9
|
-
export declare const ZIG_VERSION = "0.17.0";
|
|
10
10
|
/**
|
|
11
11
|
* Zig builds for the build host's own CPU unless told otherwise, and some Windows runners
|
|
12
12
|
* have AVX-512 while others do not; a native build then dies with STATUS_ILLEGAL_INSTRUCTION
|
|
@@ -51,16 +51,9 @@ export declare function runBuildCommand(command: string, args: readonly string[]
|
|
|
51
51
|
capture?: boolean;
|
|
52
52
|
spawnProcess?: (command: string, args: readonly string[], options: object) => SpawnResult;
|
|
53
53
|
}): string;
|
|
54
|
-
|
|
55
|
-
ok: boolean;
|
|
56
|
-
body: ReadableStream<Uint8Array> | null;
|
|
57
|
-
url: string;
|
|
58
|
-
};
|
|
59
|
-
/** Download the pinned Zig archive from ziglang.org and check its size and SHA-256. */
|
|
54
|
+
/** Download the pinned Zig archive from ziglang.org, bounded by its size, and check its SHA-256. */
|
|
60
55
|
export declare function downloadPinnedZig(archivePath: string, options?: {
|
|
61
|
-
fetch?:
|
|
62
|
-
redirect: 'follow';
|
|
63
|
-
}) => Promise<FetchResponse>;
|
|
56
|
+
fetch?: PinnedFetch;
|
|
64
57
|
expectedSize?: number;
|
|
65
58
|
expectedSha256?: string;
|
|
66
59
|
}): Promise<void>;
|
|
@@ -82,9 +75,7 @@ export declare function buildPatchedWindowsInstaller(options: {
|
|
|
82
75
|
/** Where scratch state goes; defaults to `RUNNER_TEMP`, then the system temp directory. */
|
|
83
76
|
scratchParent?: string;
|
|
84
77
|
runCommand?: WindowsBuildCommand;
|
|
85
|
-
fetch?:
|
|
86
|
-
redirect: 'follow';
|
|
87
|
-
}) => Promise<FetchResponse>;
|
|
78
|
+
fetch?: PinnedFetch;
|
|
88
79
|
zigArchiveSize?: number;
|
|
89
80
|
zigArchiveSha256?: string;
|
|
90
81
|
/** Replaces the pinned-patch apply step; tests only. */
|
|
@@ -92,4 +83,3 @@ export declare function buildPatchedWindowsInstaller(options: {
|
|
|
92
83
|
now?: () => number;
|
|
93
84
|
logStage?: (message: string) => void;
|
|
94
85
|
}): Promise<string>;
|
|
95
|
-
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { electrobunArtifacts } from "../release/release-steps.js";
|
|
2
|
-
import { ELECTROBUN_COMMIT, PINNED_SHORTCUT_PATCH, SHORTCUT_PATCH_PATH, applyElectrobunPatch } from "./electrobun-source-patch.js";
|
|
2
|
+
import { ELECTROBUN_COMMIT, ELECTROBUN_VERSION, PINNED_SHORTCUT_PATCH, SHORTCUT_PATCH_PATH, ZIG_VERSION, applyElectrobunPatch } from "./electrobun-source-patch.js";
|
|
3
|
+
import { downloadPinnedInput } from "./pinned-download.js";
|
|
3
4
|
import { join, resolve } from "node:path";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { copyFileSync, createReadStream,
|
|
6
|
+
import { copyFileSync, createReadStream, existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, unlinkSync } from "node:fs";
|
|
6
7
|
import { spawnSync } from "node:child_process";
|
|
7
8
|
import { tmpdir } from "node:os";
|
|
8
|
-
import { Readable } from "node:stream";
|
|
9
|
-
import { pipeline } from "node:stream/promises";
|
|
10
9
|
import { performance } from "node:perf_hooks";
|
|
11
10
|
// src/native/windows-extractor-build.ts
|
|
12
11
|
/**
|
|
@@ -15,9 +14,6 @@ import { performance } from "node:perf_hooks";
|
|
|
15
14
|
* rebuilds that extractor from the pinned source with the pinned Zig toolchain and points
|
|
16
15
|
* Electrobun at a copy of its devkit holding the rebuilt binary.
|
|
17
16
|
*/
|
|
18
|
-
var ELECTROBUN_VERSION = "2.0.5";
|
|
19
|
-
/** The Zig release Electrobun 2.0.5 builds with (its src/shared/build-dependencies.ts). */
|
|
20
|
-
var ZIG_VERSION = "0.17.0";
|
|
21
17
|
/**
|
|
22
18
|
* Zig builds for the build host's own CPU unless told otherwise, and some Windows runners
|
|
23
19
|
* have AVX-512 while others do not; a native build then dies with STATUS_ILLEGAL_INSTRUCTION
|
|
@@ -127,14 +123,15 @@ function runBuildCommand(command, args, options = {}) {
|
|
|
127
123
|
}
|
|
128
124
|
return options.capture ? (result.stdout ?? "").trim() : "";
|
|
129
125
|
}
|
|
130
|
-
/** Download the pinned Zig archive from ziglang.org
|
|
126
|
+
/** Download the pinned Zig archive from ziglang.org, bounded by its size, and check its SHA-256. */
|
|
131
127
|
async function downloadPinnedZig(archivePath, options = {}) {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (
|
|
128
|
+
const expectedSize = options.expectedSize ?? ZIG_WINDOWS_X64_SIZE;
|
|
129
|
+
const digest = await downloadPinnedInput(ZIG_WINDOWS_X64_URL, archivePath, expectedSize, {
|
|
130
|
+
...options.fetch ? { fetch: options.fetch } : {},
|
|
131
|
+
host: "ziglang.org"
|
|
132
|
+
});
|
|
133
|
+
if (statSync(archivePath).size !== expectedSize) throw new Error("Pinned Zig Windows archive has an unexpected size");
|
|
134
|
+
if (digest !== (options.expectedSha256 ?? ZIG_WINDOWS_X64_SHA256)) throw new Error("Pinned Zig Windows archive failed its official SHA-256 check");
|
|
138
135
|
}
|
|
139
136
|
/**
|
|
140
137
|
* Build a stable Windows x64 installer whose extractor carries the framework's shortcut
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { FeedRelease, ReleaseLedger } from '../updates/feed/release-feed';
|
|
2
2
|
import { type GitRun } from './local-provenance';
|
|
3
3
|
import type { ReleaseCutProvider } from './release-cut';
|
|
4
|
-
import type { HistoryRewrite } from './release-config';
|
|
5
4
|
/**
|
|
6
5
|
* Release feed adapter for local release cuts. The feed's ledger replaces the GitHub release
|
|
7
|
-
* listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
|
|
8
|
-
*
|
|
9
|
-
* the Release Please release of the source manifest's version, as a stageable draft. A release
|
|
6
|
+
* listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
|
|
7
|
+
* daily not yet in the ledger stands for the Release Please release of the source manifest's version, as a stageable draft. A release
|
|
10
8
|
* is qualified once its published release.json carries every payload this host builds, so a
|
|
11
9
|
* second host adds its platform to an existing release. Nothing is built remotely, so a cut
|
|
12
10
|
* is never pending and dispatch only hands the tag back to the caller to build.
|
|
@@ -21,6 +19,4 @@ export declare function createFeedReleaseCutProvider(options: {
|
|
|
21
19
|
releasedVersion: string;
|
|
22
20
|
/** The payload names this host builds for a tag. */
|
|
23
21
|
payloads(tag: string): readonly string[];
|
|
24
|
-
/** Reviewed source commits a history rewrite replaced (release config `historyRewrite`). */
|
|
25
|
-
historyRewrite?: readonly HistoryRewrite[];
|
|
26
22
|
}): ReleaseCutProvider;
|
|
@@ -1,67 +1,22 @@
|
|
|
1
|
-
import { isGitSha } from "../app/value-guards.js";
|
|
2
1
|
import { gitIsAncestor } from "./local-provenance.js";
|
|
3
2
|
// src/release/feed-release-cut.ts
|
|
4
|
-
function checkVersion(version) {
|
|
5
|
-
if (typeof version !== "string" || version.length > 64 || !/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version)) throw new Error("Invalid source version");
|
|
6
|
-
}
|
|
7
|
-
/** The highest `N` among `tags` of the form `v<version>-dev.N`; 0 when none. A malformed
|
|
8
|
-
* counter fails closed, except among bare tags (`tagsOnly`), where a name that is not a
|
|
9
|
-
* canonical dev tag can never collide with a cut and is skipped. */
|
|
10
|
-
function highestCounter(tags, version, tagsOnly = false) {
|
|
11
|
-
const prefix = `v${version}-dev.`;
|
|
12
|
-
let highest = 0;
|
|
13
|
-
for (const tag of tags) {
|
|
14
|
-
if (!tag.startsWith(prefix)) continue;
|
|
15
|
-
const suffix = tag.slice(prefix.length);
|
|
16
|
-
if (!/^[1-9]\d{0,15}$/.test(suffix) || !Number.isSafeInteger(Number(suffix))) {
|
|
17
|
-
if (tagsOnly) continue;
|
|
18
|
-
throw new Error("Invalid dev release counter");
|
|
19
|
-
}
|
|
20
|
-
highest = Math.max(highest, Number(suffix));
|
|
21
|
-
}
|
|
22
|
-
return highest;
|
|
23
|
-
}
|
|
24
|
-
async function commitTree(git, sha) {
|
|
25
|
-
const tree = await git([
|
|
26
|
-
"rev-parse",
|
|
27
|
-
"--verify",
|
|
28
|
-
`${sha}^{tree}`
|
|
29
|
-
]);
|
|
30
|
-
if (!isGitSha(tree)) throw new Error("Invalid commit tree");
|
|
31
|
-
return tree;
|
|
32
|
-
}
|
|
33
|
-
async function hasCommit(git, sha) {
|
|
34
|
-
try {
|
|
35
|
-
await git([
|
|
36
|
-
"cat-file",
|
|
37
|
-
"-e",
|
|
38
|
-
`${sha}^{commit}`
|
|
39
|
-
]);
|
|
40
|
-
return true;
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
3
|
function checkTag(tag) {
|
|
46
|
-
if (!/^v\d+\.\d+\.\d
|
|
4
|
+
if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
|
|
47
5
|
}
|
|
48
6
|
/**
|
|
49
7
|
* Release feed adapter for local release cuts. The feed's ledger replaces the GitHub release
|
|
50
|
-
* listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
|
|
51
|
-
*
|
|
52
|
-
* the Release Please release of the source manifest's version, as a stageable draft. A release
|
|
8
|
+
* listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
|
|
9
|
+
* daily not yet in the ledger stands for the Release Please release of the source manifest's version, as a stageable draft. A release
|
|
53
10
|
* is qualified once its published release.json carries every payload this host builds, so a
|
|
54
11
|
* second host adds its platform to an existing release. Nothing is built remotely, so a cut
|
|
55
12
|
* is never pending and dispatch only hands the tag back to the caller to build.
|
|
56
13
|
*/
|
|
57
14
|
function createFeedReleaseCutProvider(options) {
|
|
58
15
|
const { ledger, git } = options;
|
|
59
|
-
const rewrites = options.historyRewrite ?? [];
|
|
60
|
-
const created = /* @__PURE__ */ new Map();
|
|
61
16
|
return {
|
|
62
17
|
async find(tag) {
|
|
63
18
|
checkTag(tag);
|
|
64
|
-
const kind =
|
|
19
|
+
const kind = "daily";
|
|
65
20
|
const entry = ledger.releases.find((item) => item.tag === tag);
|
|
66
21
|
if (entry) return {
|
|
67
22
|
tag,
|
|
@@ -70,15 +25,7 @@ function createFeedReleaseCutProvider(options) {
|
|
|
70
25
|
draft: false,
|
|
71
26
|
prerelease: entry.kind !== "stable"
|
|
72
27
|
};
|
|
73
|
-
|
|
74
|
-
if (sourceSha) return {
|
|
75
|
-
tag,
|
|
76
|
-
sourceSha,
|
|
77
|
-
kind,
|
|
78
|
-
draft: false,
|
|
79
|
-
prerelease: true
|
|
80
|
-
};
|
|
81
|
-
if (kind === "daily" && tag === `v${options.releasedVersion}`) return {
|
|
28
|
+
if (tag === `v${options.releasedVersion}`) return {
|
|
82
29
|
tag,
|
|
83
30
|
sourceSha: options.sourceSha,
|
|
84
31
|
kind,
|
|
@@ -89,21 +36,6 @@ function createFeedReleaseCutProvider(options) {
|
|
|
89
36
|
return null;
|
|
90
37
|
},
|
|
91
38
|
isMainAncestor: (sha) => gitIsAncestor(git, sha, "refs/remotes/origin/main"),
|
|
92
|
-
async isAncestor(older, newer) {
|
|
93
|
-
if (older === newer) return false;
|
|
94
|
-
const rewrite = rewrites.find((entry) => entry.from === older);
|
|
95
|
-
if (!rewrite) return gitIsAncestor(git, older, newer);
|
|
96
|
-
if (!await gitIsAncestor(git, rewrite.to, "refs/remotes/origin/main")) throw new Error("History rewrite target is not on main");
|
|
97
|
-
if (await commitTree(git, rewrite.to) !== rewrite.tree) throw new Error("History rewrite tree does not match");
|
|
98
|
-
const oldTree = await hasCommit(git, rewrite.from) ? await commitTree(git, rewrite.from) : null;
|
|
99
|
-
if (oldTree !== null && oldTree !== rewrite.tree) throw new Error("History rewrite tree does not match");
|
|
100
|
-
return rewrite.to !== newer && await gitIsAncestor(git, rewrite.to, newer);
|
|
101
|
-
},
|
|
102
|
-
async create(identity) {
|
|
103
|
-
checkTag(identity.tag);
|
|
104
|
-
if (!identity.tag.includes("-dev.") || created.has(identity.tag)) throw new Error("Only a new dev release is cut locally");
|
|
105
|
-
created.set(identity.tag, identity.sourceSha);
|
|
106
|
-
},
|
|
107
39
|
async qualification(release) {
|
|
108
40
|
if (!ledger.releases.some((item) => item.tag === release.tag)) return "not-qualified";
|
|
109
41
|
try {
|
|
@@ -115,26 +47,6 @@ function createFeedReleaseCutProvider(options) {
|
|
|
115
47
|
}
|
|
116
48
|
},
|
|
117
49
|
pendingBuild: async () => "idle",
|
|
118
|
-
async highestDevCounter(version) {
|
|
119
|
-
checkVersion(version);
|
|
120
|
-
return highestCounter([...ledger.releases.map((item) => item.tag), ...created.keys()], version);
|
|
121
|
-
},
|
|
122
|
-
async highestDevTag(version) {
|
|
123
|
-
checkVersion(version);
|
|
124
|
-
return highestCounter((await git([
|
|
125
|
-
"tag",
|
|
126
|
-
"--list",
|
|
127
|
-
`v${version}-dev.*`
|
|
128
|
-
])).split("\n").map((line) => line.trim()).filter(Boolean), version, true);
|
|
129
|
-
},
|
|
130
|
-
async tagExists(tag) {
|
|
131
|
-
checkTag(tag);
|
|
132
|
-
return ledger.releases.some((item) => item.tag === tag) || await git([
|
|
133
|
-
"tag",
|
|
134
|
-
"--list",
|
|
135
|
-
tag
|
|
136
|
-
]) !== "";
|
|
137
|
-
},
|
|
138
50
|
async dispatch(tag) {
|
|
139
51
|
checkTag(tag);
|
|
140
52
|
}
|
|
@@ -29,11 +29,7 @@ async function readFeedLedger(feed, fetcher) {
|
|
|
29
29
|
const bytes = await readFeedObject(feed, "index.json", fetcher, MAX_LEDGER_BYTES);
|
|
30
30
|
const ledger = bytes ? parseReleaseLedger(json(bytes), feed.app) : null;
|
|
31
31
|
if (ledger && ledger.releases.length > 0) return ledger;
|
|
32
|
-
for (const channel of [
|
|
33
|
-
"dev",
|
|
34
|
-
"daily",
|
|
35
|
-
"stable"
|
|
36
|
-
]) if (await readFeedObject(feed, `channels/${channel}.json`, fetcher, MAX_RELEASE_BYTES) !== null) throw new Error("Release ledger is missing or empty while a channel exists");
|
|
32
|
+
for (const channel of ["daily", "stable"]) if (await readFeedObject(feed, `channels/${channel}.json`, fetcher, MAX_RELEASE_BYTES) !== null) throw new Error("Release ledger is missing or empty while a channel exists");
|
|
37
33
|
return ledger ?? {
|
|
38
34
|
schema: 1,
|
|
39
35
|
app: feed.app,
|
|
@@ -25,12 +25,8 @@ function createGitHubReleaseCutProvider(options) {
|
|
|
25
25
|
const result = await read(`${base}/compare/${sha}...main`);
|
|
26
26
|
return ["ahead", "identical"].includes(String(result?.status));
|
|
27
27
|
};
|
|
28
|
-
const isAncestor = async (older, newer) => {
|
|
29
|
-
if (!isGitSha(older) || !isGitSha(newer)) return false;
|
|
30
|
-
return (await read(`${base}/compare/${older}...${newer}`))?.status === "ahead";
|
|
31
|
-
};
|
|
32
28
|
async function tagExists(tag) {
|
|
33
|
-
if (!/^v\d+\.\d+\.\d
|
|
29
|
+
if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
|
|
34
30
|
try {
|
|
35
31
|
const value = await read(`${base}/git/ref/tags/${encodeURIComponent(tag)}`);
|
|
36
32
|
if (typeof value !== "object" || value === null || Array.isArray(value) || value.ref !== `refs/tags/${tag}`) throw new Error("Invalid tag response");
|
|
@@ -42,48 +38,10 @@ function createGitHubReleaseCutProvider(options) {
|
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
return {
|
|
45
|
-
tagExists,
|
|
46
|
-
isAncestor,
|
|
47
|
-
async highestDevCounter(version) {
|
|
48
|
-
if (typeof version !== "string" || version.length > 64 || !/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version)) throw new Error("Invalid source version");
|
|
49
|
-
const prefix = `v${version}-dev.`;
|
|
50
|
-
let highest = 0;
|
|
51
|
-
for (let page = 1; page <= 100; page++) {
|
|
52
|
-
const result = await read(`${base}/releases?per_page=100&page=${page}`);
|
|
53
|
-
if (!Array.isArray(result) || result.length > 100) throw new Error("Invalid release history");
|
|
54
|
-
for (const value of result) {
|
|
55
|
-
if (typeof value !== "object" || value === null || Array.isArray(value) || typeof value.tag_name !== "string") throw new Error("Invalid release history");
|
|
56
|
-
const tag = value.tag_name;
|
|
57
|
-
if (!tag.startsWith(prefix)) continue;
|
|
58
|
-
const suffix = tag.slice(prefix.length);
|
|
59
|
-
if (!/^\d+$/.test(suffix) || suffix.length > 16 || !Number.isSafeInteger(Number(suffix))) throw new Error("Invalid dev release counter");
|
|
60
|
-
highest = Math.max(highest, Number(suffix));
|
|
61
|
-
}
|
|
62
|
-
if (result.length < 100) return highest;
|
|
63
|
-
}
|
|
64
|
-
throw new Error("Release history exceeds inspection limit");
|
|
65
|
-
},
|
|
66
|
-
async highestDevTag(version) {
|
|
67
|
-
if (typeof version !== "string" || version.length > 64 || !/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version)) throw new Error("Invalid source version");
|
|
68
|
-
const prefix = `refs/tags/v${version}-dev.`;
|
|
69
|
-
const result = await read(`${base}/git/matching-refs/tags/${encodeURIComponent(`v${version}-dev.`)}`);
|
|
70
|
-
if (!Array.isArray(result) || result.length > 1e5) throw new Error("Invalid tag history");
|
|
71
|
-
let highest = 0;
|
|
72
|
-
for (const value of result) {
|
|
73
|
-
const ref = value?.ref;
|
|
74
|
-
if (typeof ref !== "string") throw new Error("Invalid tag history");
|
|
75
|
-
if (!ref.startsWith(prefix)) continue;
|
|
76
|
-
const suffix = ref.slice(prefix.length);
|
|
77
|
-
if (!/^[1-9]\d{0,15}$/.test(suffix) || !Number.isSafeInteger(Number(suffix))) continue;
|
|
78
|
-
highest = Math.max(highest, Number(suffix));
|
|
79
|
-
}
|
|
80
|
-
return highest;
|
|
81
|
-
},
|
|
82
41
|
async find(tag) {
|
|
83
|
-
if (!/^v\d+\.\d+\.\d
|
|
84
|
-
const kind = tag.includes("-dev.") ? "dev" : "daily";
|
|
42
|
+
if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
|
|
85
43
|
const found = await releaseData(tag);
|
|
86
|
-
if (!found && (!options.hiddenDrafts ||
|
|
44
|
+
if (!found && (!options.hiddenDrafts || !await tagExists(tag))) return null;
|
|
87
45
|
const release = found ?? {
|
|
88
46
|
tag_name: tag,
|
|
89
47
|
draft: true,
|
|
@@ -100,35 +58,16 @@ function createGitHubReleaseCutProvider(options) {
|
|
|
100
58
|
read,
|
|
101
59
|
base
|
|
102
60
|
})) throw new Error("Release provenance mismatch");
|
|
103
|
-
const stageableDraft = release.draft && kind === "daily" && !release.body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "));
|
|
104
61
|
return {
|
|
105
62
|
tag,
|
|
106
63
|
sourceSha: target.sha,
|
|
107
|
-
kind,
|
|
64
|
+
kind: "daily",
|
|
108
65
|
draft: release.draft,
|
|
109
66
|
prerelease: release.prerelease,
|
|
110
|
-
...
|
|
67
|
+
...release.draft ? { stageableDraft: true } : {}
|
|
111
68
|
};
|
|
112
69
|
},
|
|
113
70
|
isMainAncestor,
|
|
114
|
-
async create(identity) {
|
|
115
|
-
const body = {
|
|
116
|
-
tag_name: identity.tag,
|
|
117
|
-
target_commitish: identity.sourceSha,
|
|
118
|
-
name: `${appName} ${identity.tag}`,
|
|
119
|
-
prerelease: true,
|
|
120
|
-
make_latest: "false",
|
|
121
|
-
body: `adea-channel:dev\n\nSource: ${identity.sourceSha}`
|
|
122
|
-
};
|
|
123
|
-
await run([
|
|
124
|
-
"api",
|
|
125
|
-
`${base}/releases`,
|
|
126
|
-
"--method",
|
|
127
|
-
"POST",
|
|
128
|
-
"--input",
|
|
129
|
-
"-"
|
|
130
|
-
], JSON.stringify(body));
|
|
131
|
-
},
|
|
132
71
|
async qualification(release) {
|
|
133
72
|
try {
|
|
134
73
|
const current = await releaseData(release.tag);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Whether a release note carries a cutter's channel or source marker, which no daily does. */
|
|
2
|
+
export declare const hasCutterMarker: (body: string) => boolean;
|
|
1
3
|
/** Check the tag and source independently; legacy release notes are never rewritten. */
|
|
2
4
|
export declare function verifyReleaseProvenance(options: {
|
|
3
5
|
tag: string;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { isGitSha } from "../app/value-guards.js";
|
|
2
2
|
// src/release/github-release-provenance.ts
|
|
3
|
+
/** Whether a release note carries a cutter's channel or source marker, which no daily does. */
|
|
4
|
+
var hasCutterMarker = (body) => body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "));
|
|
3
5
|
/** Check the tag and source independently; legacy release notes are never rewritten. */
|
|
4
6
|
async function verifyReleaseProvenance(options) {
|
|
5
7
|
const { tag, sourceSha, body, releasePleaseManifestPath, read, base } = options;
|
|
6
8
|
if (!isGitSha(sourceSha)) return false;
|
|
7
|
-
|
|
8
|
-
const markers = lines.filter((line) => line.startsWith("adea-channel:"));
|
|
9
|
-
const sources = lines.filter((line) => line.startsWith("Source: "));
|
|
10
|
-
const kind = tag.includes("-dev.") ? "dev" : "daily";
|
|
11
|
-
if (kind === "dev" && markers.length === 1 && markers[0] === "adea-channel:dev" && sources.length === 1 && sources[0] === `Source: ${sourceSha}`) return true;
|
|
12
|
-
if (kind !== "daily" || markers.length || sources.length || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !/^[A-Za-z0-9._/-]+\.json$/.test(releasePleaseManifestPath) || releasePleaseManifestPath.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
9
|
+
if (hasCutterMarker(body) || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !/^[A-Za-z0-9._/-]+\.json$/.test(releasePleaseManifestPath) || releasePleaseManifestPath.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
13
10
|
const result = await read(`${base}/contents/${releasePleaseManifestPath.split("/").map(encodeURIComponent).join("/")}?ref=${sourceSha}`);
|
|
14
11
|
if (typeof result !== "object" || result === null || Array.isArray(result)) return false;
|
|
15
12
|
const data = result;
|
|
@@ -25,4 +22,4 @@ async function verifyReleaseProvenance(options) {
|
|
|
25
22
|
return false;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
export { verifyReleaseProvenance };
|
|
25
|
+
export { hasCutterMarker, verifyReleaseProvenance };
|
|
@@ -8,7 +8,7 @@ import { isRepositorySlug } from "../updates/feed/signed-release.js";
|
|
|
8
8
|
/** GitHub adapter; callers must run it in a trusted release job with GH_TOKEN. */
|
|
9
9
|
function createGitHubReleasePublisher(options) {
|
|
10
10
|
const { repository, identity } = options;
|
|
11
|
-
if (!isRepositorySlug(repository) || identity.tag.length > 65 || !/^v[0-9]+\.[0-9]+\.[0-9]
|
|
11
|
+
if (!isRepositorySlug(repository) || identity.tag.length > 65 || !/^v[0-9]+\.[0-9]+\.[0-9]+$/.test(identity.tag) || !isGitSha(identity.sourceSha) || !isGitSha(identity.workflowSha)) throw new Error("Invalid GitHub release identity");
|
|
12
12
|
const run = options.run ?? githubCli();
|
|
13
13
|
const base = `repos/${repository}`;
|
|
14
14
|
const read = async (path) => JSON.parse(await run(["api", path]));
|
|
@@ -32,7 +32,7 @@ function createGitHubReleasePublisher(options) {
|
|
|
32
32
|
const workflow = workflowComparison;
|
|
33
33
|
if (!release || typeof release.tag_name !== "string" || typeof release.draft !== "boolean" || typeof release.body !== "string") throw new Error("Invalid GitHub release response");
|
|
34
34
|
const assets = await listGitHubReleaseAssets(read, base, release.id);
|
|
35
|
-
const provenance =
|
|
35
|
+
const provenance = await verifyReleaseProvenance({
|
|
36
36
|
tag: identity.tag,
|
|
37
37
|
sourceSha: identity.sourceSha,
|
|
38
38
|
body: release.body,
|
|
@@ -9,7 +9,7 @@ import { createHash } from "node:crypto";
|
|
|
9
9
|
/** Verify immutable GitHub release assets and the exact successful workflow attempt. */
|
|
10
10
|
async function qualifyGitHubRelease(options) {
|
|
11
11
|
const { repository, tag, requirements } = options;
|
|
12
|
-
if (!isRepositorySlug(repository) || tag.length > 65 || !/^v\d+\.\d+\.\d
|
|
12
|
+
if (!isRepositorySlug(repository) || tag.length > 65 || !/^v\d+\.\d+\.\d+$/.test(tag)) throw new Error("Invalid release identity");
|
|
13
13
|
const run = options.run ?? githubCli();
|
|
14
14
|
const base = `repos/${repository}`;
|
|
15
15
|
const read = async (path) => JSON.parse(await run(["api", path]));
|
|
@@ -21,7 +21,7 @@ async function qualifyGitHubRelease(options) {
|
|
|
21
21
|
}), read(`${base}/commits/${encodeURIComponent(tag)}`)]);
|
|
22
22
|
const release = releaseData;
|
|
23
23
|
const sourceSha = commitData?.sha;
|
|
24
|
-
if (!release || release.tag_name !== tag || release.draft !== false && !(release.draft === true && options.allowDraft === true) || typeof release.body !== "string" ||
|
|
24
|
+
if (!release || release.tag_name !== tag || release.draft !== false && !(release.draft === true && options.allowDraft === true) || typeof release.body !== "string" || typeof sourceSha !== "string" || !await verifyReleaseProvenance({
|
|
25
25
|
tag,
|
|
26
26
|
sourceSha,
|
|
27
27
|
body: release.body,
|
|
@@ -37,7 +37,7 @@ async function qualifyGitHubRelease(options) {
|
|
|
37
37
|
return runOrder < 0n ? -1 : runOrder > 0n ? 1 : Number(second[2]) - Number(first[2]);
|
|
38
38
|
});
|
|
39
39
|
for (const asset of candidates) try {
|
|
40
|
-
if (
|
|
40
|
+
if (!Number.isSafeInteger(asset.size) || asset.size < 1 || asset.size > 262144) throw new Error("Invalid qualification asset");
|
|
41
41
|
const text = await run([
|
|
42
42
|
"release",
|
|
43
43
|
"download",
|
|
@@ -26,10 +26,10 @@ export type UploadPlan = Readonly<{
|
|
|
26
26
|
}>;
|
|
27
27
|
/** The release platform of this machine. */
|
|
28
28
|
export declare function hostReleasePlatform(platform?: string, arch?: string): ReleasePlatform;
|
|
29
|
-
/** Cut or resume
|
|
29
|
+
/** Cut or resume the daily release from a clean local checkout of `sourceSha`, with
|
|
30
30
|
* version state from the feed's ledger. `dispatched` means: build and publish this tag. */
|
|
31
31
|
export declare function runLocalReleaseCut(options: {
|
|
32
|
-
kind: '
|
|
32
|
+
kind: 'daily';
|
|
33
33
|
config: unknown;
|
|
34
34
|
sourceSha: string;
|
|
35
35
|
platform: ReleasePlatform;
|
|
@@ -43,7 +43,7 @@ export declare function runLocalReleaseCut(options: {
|
|
|
43
43
|
platform: "linux-x64" | "macos-arm64" | "windows-x64";
|
|
44
44
|
}>;
|
|
45
45
|
/** Local provenance for an already cut tag: a clean checkout of `sourceSha` on origin/main whose
|
|
46
|
-
* manifest
|
|
46
|
+
* manifest names the tag's version. */
|
|
47
47
|
export declare function localTagProvenance(options: {
|
|
48
48
|
config: unknown;
|
|
49
49
|
tag: string;
|
|
@@ -6,8 +6,8 @@ import { verifyReleaseDescriptor } from "../updates/feed/signed-release.js";
|
|
|
6
6
|
import { createFeedReleaseCutProvider } from "./feed-release-cut.js";
|
|
7
7
|
import { ReleaseFeedSnapshotChanged, readFeedLedger, readFeedRelease, verifyFeedRelease } from "./feed-state.js";
|
|
8
8
|
import { resolveLocalProvenance } from "./local-provenance.js";
|
|
9
|
-
import { discoveryPolicies, parseReleaseConfig, platformPayloads, platformTargets } from "./release-config.js";
|
|
10
|
-
import { cutRelease
|
|
9
|
+
import { discoveryPolicies, parseReleaseConfig, platformPayloads, platformTargets, releaseVerificationKeys } from "./release-config.js";
|
|
10
|
+
import { cutRelease } from "./release-cut.js";
|
|
11
11
|
import { configuredSigningKey, signDiscoveryDescriptors, writeDescriptors } from "./release-descriptor-staging.js";
|
|
12
12
|
import { fileIdentity } from "./release-publication.js";
|
|
13
13
|
import { promoteDailyRelease } from "./release-promotion.js";
|
|
@@ -22,7 +22,6 @@ import { createHash } from "node:crypto";
|
|
|
22
22
|
* object keys and an ordered upload plan; the caller uploads it with its own credentials.
|
|
23
23
|
*/
|
|
24
24
|
var UPLOAD_PLAN = "upload-plan.json";
|
|
25
|
-
var channelOf = (tag) => tag.includes("-dev.") ? "dev" : "daily";
|
|
26
25
|
var IMMUTABLE = "public, max-age=31536000, immutable";
|
|
27
26
|
var MUTABLE = "no-cache";
|
|
28
27
|
/** The release platform of this machine. */
|
|
@@ -33,14 +32,7 @@ function hostReleasePlatform(platform = process.platform, arch = process.arch) {
|
|
|
33
32
|
}
|
|
34
33
|
function localConfig(config) {
|
|
35
34
|
const parsed = parseReleaseConfig(config);
|
|
36
|
-
|
|
37
|
-
const entries = Object.entries(config.releaseSigningKeys);
|
|
38
|
-
if (!entries.length || entries.length > 16) throw new Error("Missing release verification keys");
|
|
39
|
-
const keys = /* @__PURE__ */ new Map();
|
|
40
|
-
for (const [id, encoded] of entries) {
|
|
41
|
-
if (!/^[a-z0-9][a-z0-9._-]{0,63}$/.test(id) || typeof encoded !== "string" || Buffer.from(encoded, "base64").length !== 32 || Buffer.from(encoded, "base64").toString("base64") !== encoded) throw new Error("Invalid release verification key");
|
|
42
|
-
keys.set(id, encoded);
|
|
43
|
-
}
|
|
35
|
+
const keys = releaseVerificationKeys(config);
|
|
44
36
|
return {
|
|
45
37
|
...parsed,
|
|
46
38
|
config,
|
|
@@ -56,7 +48,7 @@ async function exactFiles(directory, names) {
|
|
|
56
48
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
57
49
|
if (entries.length !== names.length || entries.some((entry) => !entry.isFile() || !names.includes(entry.name))) throw new Error("Staged directory does not hold exactly the platform release files");
|
|
58
50
|
}
|
|
59
|
-
/** Cut or resume
|
|
51
|
+
/** Cut or resume the daily release from a clean local checkout of `sourceSha`, with
|
|
60
52
|
* version state from the feed's ledger. `dispatched` means: build and publish this tag. */
|
|
61
53
|
async function runLocalReleaseCut(options) {
|
|
62
54
|
const { kind, git, platform } = options;
|
|
@@ -73,8 +65,7 @@ async function runLocalReleaseCut(options) {
|
|
|
73
65
|
git,
|
|
74
66
|
sourceSha: provenance.sourceSha,
|
|
75
67
|
releasedVersion: provenance.releasedVersion,
|
|
76
|
-
payloads: (tag) => platformPayloads(parsed.requirements(tag), platform)
|
|
77
|
-
historyRewrite: parsed.historyRewrite
|
|
68
|
+
payloads: (tag) => platformPayloads(parsed.requirements(tag), platform)
|
|
78
69
|
});
|
|
79
70
|
const result = await cutRelease({
|
|
80
71
|
kind,
|
|
@@ -89,7 +80,7 @@ async function runLocalReleaseCut(options) {
|
|
|
89
80
|
};
|
|
90
81
|
}
|
|
91
82
|
/** Local provenance for an already cut tag: a clean checkout of `sourceSha` on origin/main whose
|
|
92
|
-
* manifest
|
|
83
|
+
* manifest names the tag's version. */
|
|
93
84
|
async function localTagProvenance(options) {
|
|
94
85
|
const parsed = parseReleaseConfig(options.config);
|
|
95
86
|
parsed.requirements(options.tag);
|
|
@@ -98,8 +89,7 @@ async function localTagProvenance(options) {
|
|
|
98
89
|
sourceSha: options.sourceSha,
|
|
99
90
|
versionSourcePath: parsed.versionSource.path
|
|
100
91
|
});
|
|
101
|
-
|
|
102
|
-
if (channelOf(options.tag) === "dev" ? !options.tag.startsWith(expected) : options.tag !== expected) throw new Error("Release tag does not belong to the source version");
|
|
92
|
+
if (options.tag !== `v${provenance.releasedVersion}`) throw new Error("Release tag does not belong to the source version");
|
|
103
93
|
return { repository: provenance.repository };
|
|
104
94
|
}
|
|
105
95
|
/**
|
|
@@ -142,7 +132,6 @@ function pointerChannels(ledger, tag) {
|
|
|
142
132
|
const entry = ledger.releases.find((item) => item.tag === tag);
|
|
143
133
|
if (!entry) return [];
|
|
144
134
|
const newest = (kinds) => ledger.releases.filter((item) => kinds.includes(item.kind)).reduce((best, item) => !best || versionLessThan(best.tag, item.tag) ? item : best, void 0)?.tag === tag;
|
|
145
|
-
if (entry.kind === "dev") return newest(["dev"]) ? ["dev"] : [];
|
|
146
135
|
return [...newest(["daily", "stable"]) ? ["daily"] : [], ...entry.kind === "stable" && newest(["stable"]) ? ["stable"] : []];
|
|
147
136
|
}
|
|
148
137
|
var jsonBytes = (value) => Buffer.from(JSON.stringify(value, null, 2) + "\n");
|
|
@@ -315,7 +304,7 @@ async function stageLocalRelease(options) {
|
|
|
315
304
|
app: feed.app,
|
|
316
305
|
releases: entry ? ledger.releases : [{
|
|
317
306
|
tag,
|
|
318
|
-
kind:
|
|
307
|
+
kind: "daily",
|
|
319
308
|
version: tag.slice(1),
|
|
320
309
|
sourceSha,
|
|
321
310
|
publishedAt: now
|
|
@@ -324,7 +313,7 @@ async function stageLocalRelease(options) {
|
|
|
324
313
|
const remaining = remote?.missingPlatforms?.filter((name) => name !== platform);
|
|
325
314
|
const release = {
|
|
326
315
|
tag,
|
|
327
|
-
channel:
|
|
316
|
+
channel: remote?.channel ?? "daily",
|
|
328
317
|
publishedAt: remote?.publishedAt ?? now,
|
|
329
318
|
assets: merged,
|
|
330
319
|
...entry?.kind === "stable" && remaining?.length ? { missingPlatforms: remaining } : {}
|
|
@@ -377,14 +366,14 @@ async function runLocalPromotion(options) {
|
|
|
377
366
|
let selectionChanged = false;
|
|
378
367
|
const provider = {
|
|
379
368
|
async list() {
|
|
380
|
-
return ledger.releases.
|
|
369
|
+
return ledger.releases.flatMap((entry, index) => entry.kind === "dev" ? [] : [{
|
|
381
370
|
id: ledger.releases.length - index,
|
|
382
371
|
tag: entry.tag,
|
|
383
|
-
body: entry.kind === "
|
|
372
|
+
body: entry.kind === "stable" ? `<!-- adea-stable:v1 ${entry.tag} -->\n<!-- adea-stable-time:${entry.promotedAt} -->` : "",
|
|
384
373
|
draft: false,
|
|
385
374
|
prerelease: entry.kind !== "stable",
|
|
386
375
|
publishedAt: entry.publishedAt
|
|
387
|
-
})
|
|
376
|
+
}]);
|
|
388
377
|
},
|
|
389
378
|
async qualify(release) {
|
|
390
379
|
if (selectionChanged) return false;
|
|
@@ -23,7 +23,7 @@ async function planQualificationRun(options) {
|
|
|
23
23
|
runId: env.GITHUB_RUN_ID,
|
|
24
24
|
runAttempt: Number(env.GITHUB_RUN_ATTEMPT)
|
|
25
25
|
};
|
|
26
|
-
if (env.GITLAB_CI !== "true" || env.CI_COMMIT_TAG !== tag || !isGitSha(env.CI_COMMIT_SHA) || !/^[1-9]\d{0,19}$/.test(env.CI_PIPELINE_ID ?? "") || !/^v\d+\.\d+\.\d
|
|
26
|
+
if (env.GITLAB_CI !== "true" || env.CI_COMMIT_TAG !== tag || !isGitSha(env.CI_COMMIT_SHA) || !/^[1-9]\d{0,19}$/.test(env.CI_PIPELINE_ID ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Qualification requires a GitHub release-assets run or a GitLab tag pipeline");
|
|
27
27
|
const sourceSha = env.CI_COMMIT_SHA;
|
|
28
28
|
await localTagProvenance({
|
|
29
29
|
config,
|
|
@@ -35,7 +35,7 @@ function releasePlanGitHubEnvironment(env) {
|
|
|
35
35
|
/** Resolve the immutable release source before building anything in a trusted assets workflow. */
|
|
36
36
|
async function planReleaseAssets(options) {
|
|
37
37
|
const { env, config, tag } = options;
|
|
38
|
-
if (env.GITHUB_ACTIONS !== "true" || env.GITHUB_REF !== "refs/heads/main" || env.GITHUB_EVENT_NAME !== "workflow_dispatch" || !isRepositorySlug(env.GITHUB_REPOSITORY ?? "") || !isGitSha(env.GITHUB_SHA) || !/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? "") || !/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? "") || !/^v\d+\.\d+\.\d
|
|
38
|
+
if (env.GITHUB_ACTIONS !== "true" || env.GITHUB_REF !== "refs/heads/main" || env.GITHUB_EVENT_NAME !== "workflow_dispatch" || !isRepositorySlug(env.GITHUB_REPOSITORY ?? "") || !isGitSha(env.GITHUB_SHA) || !/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? "") || !/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Asset planning requires a trusted main workflow and valid tag");
|
|
39
39
|
if (typeof config !== "object" || config === null || Array.isArray(config) || typeof config.appName !== "string") throw new Error("Invalid release configuration");
|
|
40
40
|
const parsed = parseReleaseConfig(config);
|
|
41
41
|
const { requirements, releasePleaseManifestPath } = parsed;
|