@rightkit/ci 0.2.45 → 0.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/README.md +90 -3
- package/artifacts.mjs +290 -0
- package/artifacts.test.mjs +168 -0
- package/checkout.test.mjs +1 -0
- package/cli/right-git.mjs +4 -0
- package/guard-coverage.test.mjs +1 -0
- package/manifest.mjs +545 -30
- package/manifest.schema.json +138 -6
- package/manifest.test.mjs +48 -0
- package/orkflows.test.mjs +0 -0
- package/package.json +2 -2
- package/render.test.mjs +362 -27
- package/supersede.mjs +127 -0
- package/supersede.test.mjs +84 -0
- package/swift-check.test.mjs +95 -0
- package/sync.mjs +4 -1
- package/templates/ci.yml +4 -4
- package/templates/profiles/rust-hybrid/ci.yml +4 -4
- package/templates/profiles/rust-hybrid/release-candidate.yml +2 -1
- package/templates/profiles/rust-hybrid/sign-existing.yml +36 -0
- package/templates/swift-check.yml +85 -0
- package/workflows.mjs +638 -0
- package/workflows.test.mjs +213 -0
package/manifest.mjs
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { validateCheckout } from "./checkout.mjs";
|
|
8
|
+
import { validateWorkflows } from "./workflows.mjs";
|
|
8
9
|
|
|
9
10
|
export const MANIFEST_FILENAME = ".rightgit.json";
|
|
10
11
|
|
|
11
12
|
export const KNOWN_LANES = Object.freeze([
|
|
12
13
|
"ci",
|
|
14
|
+
"swift-check",
|
|
13
15
|
"qualification",
|
|
14
16
|
"package-smoke",
|
|
15
17
|
"release-candidate",
|
|
@@ -18,9 +20,15 @@ export const KNOWN_LANES = Object.freeze([
|
|
|
18
20
|
"regenerate",
|
|
19
21
|
]);
|
|
20
22
|
|
|
23
|
+
// Lanes only the rust-hybrid profile has a template for. They are kept out of KNOWN_LANES so the node
|
|
24
|
+
// profile's per-lane template checks do not look for a template it does not have.
|
|
25
|
+
export const RUST_HYBRID_ONLY_LANES = Object.freeze(["sign-existing"]);
|
|
26
|
+
|
|
21
27
|
// Rendered filename for each lane, installed under <repo>/.github/workflows/.
|
|
22
28
|
export const LANE_FILENAMES = Object.freeze({
|
|
29
|
+
"sign-existing": "sign-existing.yml",
|
|
23
30
|
ci: "ci.yml",
|
|
31
|
+
"swift-check": "swift-check.yml",
|
|
24
32
|
qualification: "qualification.yml",
|
|
25
33
|
"package-smoke": "package-smoke.yml",
|
|
26
34
|
"release-candidate": "release-candidate.yml",
|
|
@@ -74,16 +82,19 @@ const TOP_LEVEL_KEYS = new Set([
|
|
|
74
82
|
"swift",
|
|
75
83
|
"checkout",
|
|
76
84
|
"defaultBranch",
|
|
85
|
+
"signExisting",
|
|
86
|
+
"workflows",
|
|
77
87
|
]);
|
|
78
88
|
// Optional QA evidence upload (rust-hybrid ci only). qaEvidencePath is a safe
|
|
79
89
|
// relative path under $RUNNER_TEMP; it renders as `${{ runner.temp }}/<path>`.
|
|
80
90
|
const QA_EVIDENCE_DEFAULT_RETENTION_DAYS = 7;
|
|
81
91
|
const QA_EVIDENCE_MAX_RETENTION_DAYS = 90;
|
|
82
92
|
// Pinned to the same upload-artifact release the rust-hybrid release-candidate template uses.
|
|
83
|
-
const UPLOAD_ARTIFACT_PIN = "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4";
|
|
93
|
+
export const UPLOAD_ARTIFACT_PIN = "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4";
|
|
84
94
|
const GATE_PATH_RE = /^(?!.*\.\.)(?!.*\s)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
85
95
|
const RUST_WORKSPACE_PATH_RE = /^(?:\.|(?!.*\.\.)(?!.*\s)[A-Za-z0-9][A-Za-z0-9._/-]*)$/;
|
|
86
96
|
const PACKAGE_SCRIPT_RE = /^[A-Za-z0-9][A-Za-z0-9:_-]*$/;
|
|
97
|
+
const QA_SURFACE_SCRIPT_RE = /qa-native|qa-control|dev-native|dev-inspect|test-mode/i;
|
|
87
98
|
const GITHUB_VARIABLE_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
88
99
|
const RELEASE_PLATFORMS = new Set(["windows", "macos", "linux"]);
|
|
89
100
|
const RELEASE_ARCHITECTURES = new Set(["x86_64", "arm64"]);
|
|
@@ -135,7 +146,7 @@ export function validateManifest(manifest) {
|
|
|
135
146
|
lanes = manifest.lanes;
|
|
136
147
|
const seen = new Set();
|
|
137
148
|
for (const lane of lanes) {
|
|
138
|
-
if (typeof lane !== "string" || !KNOWN_LANES.includes(lane)) {
|
|
149
|
+
if (typeof lane !== "string" || !(KNOWN_LANES.includes(lane) || RUST_HYBRID_ONLY_LANES.includes(lane))) {
|
|
139
150
|
errors.push(`unknown lane: ${JSON.stringify(lane)}`);
|
|
140
151
|
} else if (seen.has(lane)) {
|
|
141
152
|
errors.push(`duplicate lane: ${lane}`);
|
|
@@ -172,14 +183,15 @@ export function validateManifest(manifest) {
|
|
|
172
183
|
const profile = manifest.profile === undefined ? "node" : manifest.profile;
|
|
173
184
|
if (profile !== "node" && profile !== "rust-hybrid") errors.push("profile must be 'node' or 'rust-hybrid'");
|
|
174
185
|
if (profile === "rust-hybrid") {
|
|
175
|
-
if (lanes.some((lane) => lane !== "ci" && lane !== "release-candidate" && lane !== "regenerate") || !lanes.includes("ci")) {
|
|
176
|
-
errors.push("profile 'rust-hybrid' requires lane 'ci' and supports optional lanes 'release-candidate' and '
|
|
186
|
+
if (lanes.some((lane) => lane !== "ci" && lane !== "release-candidate" && lane !== "regenerate" && lane !== "sign-existing") || !lanes.includes("ci")) {
|
|
187
|
+
errors.push("profile 'rust-hybrid' requires lane 'ci' and supports optional lanes 'release-candidate', 'regenerate' and 'sign-existing'");
|
|
177
188
|
}
|
|
178
189
|
if (!manifest.gate || typeof manifest.gate !== "object" || Array.isArray(manifest.gate) || Object.keys(manifest.gate).some((key) => key !== "path") || typeof manifest.gate.path !== "string" || !GATE_PATH_RE.test(manifest.gate.path)) {
|
|
179
190
|
errors.push("profile 'rust-hybrid' requires gate.path with a safe relative path");
|
|
180
191
|
}
|
|
181
|
-
} else
|
|
182
|
-
errors.push("gate is only valid for profile 'rust-hybrid'");
|
|
192
|
+
} else {
|
|
193
|
+
if (manifest.gate !== undefined) errors.push("gate is only valid for profile 'rust-hybrid'");
|
|
194
|
+
if (lanes.some((lane) => RUST_HYBRID_ONLY_LANES.includes(lane))) errors.push("lane 'sign-existing' is only valid for profile 'rust-hybrid'");
|
|
183
195
|
}
|
|
184
196
|
|
|
185
197
|
validateCheckout(manifest.checkout, errors);
|
|
@@ -225,7 +237,9 @@ export function validateManifest(manifest) {
|
|
|
225
237
|
|
|
226
238
|
if (manifest.concurrency !== undefined) validateConcurrency(manifest, lanes, errors);
|
|
227
239
|
validateDevArtifact(manifest, profile, errors);
|
|
240
|
+
validateWorkflows(manifest, errors);
|
|
228
241
|
validateRegenerate(manifest, lanes, errors);
|
|
242
|
+
validateSignExisting(manifest, lanes, errors);
|
|
229
243
|
|
|
230
244
|
const rustCache = manifest.rustCache;
|
|
231
245
|
if (rustCache !== undefined) {
|
|
@@ -259,7 +273,34 @@ export function validateManifest(manifest) {
|
|
|
259
273
|
errors.push("candidate must be an object");
|
|
260
274
|
} else {
|
|
261
275
|
for (const key of Object.keys(candidate)) {
|
|
262
|
-
if (!["buildScript", "checkScript", "admissionScript", "stageSummaryScript", "artifactRoot", "os", "targets", "signWindows", "signMacos", "releaseChain"].includes(key)) errors.push(`unknown candidate field: ${key}`);
|
|
276
|
+
if (!["buildScript", "checkScript", "admissionScript", "stageSummaryScript", "artifactRoot", "os", "targets", "signWindows", "signMacos", "releaseChain", "devQualification"].includes(key)) errors.push(`unknown candidate field: ${key}`);
|
|
277
|
+
}
|
|
278
|
+
// The sealed, signed candidate must be QA-free (@rightkit/release refuses
|
|
279
|
+
// these surfaces in any release tier). The manifest only carries script
|
|
280
|
+
// names, not the build command's features, so this can only catch a
|
|
281
|
+
// script NAMED after a QA surface; the real check stays in @rightkit/release.
|
|
282
|
+
for (const key of ["buildScript", "checkScript"]) {
|
|
283
|
+
if (typeof candidate[key] === "string" && QA_SURFACE_SCRIPT_RE.test(candidate[key])) {
|
|
284
|
+
errors.push(`candidate.${key} '${candidate[key]}' names a QA surface (qa-native, qa-control, dev-native, dev-inspect or test-mode); the signed candidate must be QA-free. Run in-app journeys against the dev build with candidate.devQualification (see Orthic-Labs/rightkit#107)`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (candidate.devQualification !== undefined) {
|
|
288
|
+
const dev = candidate.devQualification;
|
|
289
|
+
if (dev === null || typeof dev !== "object" || Array.isArray(dev)) {
|
|
290
|
+
errors.push("candidate.devQualification must be an object { buildScript, journeyScript }");
|
|
291
|
+
} else {
|
|
292
|
+
for (const key of Object.keys(dev)) {
|
|
293
|
+
if (!["buildScript", "journeyScript"].includes(key)) errors.push(`unknown candidate.devQualification field: ${key}`);
|
|
294
|
+
}
|
|
295
|
+
for (const key of ["buildScript", "journeyScript"]) {
|
|
296
|
+
if (typeof dev[key] !== "string" || !PACKAGE_SCRIPT_RE.test(dev[key])) {
|
|
297
|
+
errors.push(`candidate.devQualification.${key} must be one safe package script name`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (typeof dev.buildScript === "string" && dev.buildScript === candidate.buildScript) {
|
|
301
|
+
errors.push("candidate.devQualification.buildScript must differ from candidate.buildScript: the dev build (QA surface on) is never the sealed candidate build (Orthic-Labs/rightkit#107)");
|
|
302
|
+
}
|
|
303
|
+
}
|
|
263
304
|
}
|
|
264
305
|
// admissionScript & stageSummaryScript are required for EVERY release-candidate
|
|
265
306
|
// lane, not just signed/full-releaseChain ones: the tag-last workflow's
|
|
@@ -395,6 +436,7 @@ export function validateManifest(manifest) {
|
|
|
395
436
|
}
|
|
396
437
|
}
|
|
397
438
|
if (manifest.swift !== undefined) validateSwift(manifest, lanes, errors);
|
|
439
|
+
if (lanes.includes("swift-check") && manifest.swift?.check === undefined) errors.push("lane 'swift-check' requires swift.check");
|
|
398
440
|
if (profile !== "rust-hybrid" && candidate !== undefined) {
|
|
399
441
|
errors.push("candidate is only valid for profile 'rust-hybrid'");
|
|
400
442
|
}
|
|
@@ -490,7 +532,7 @@ export function loadManifest(repoPath) {
|
|
|
490
532
|
return { ok: true, manifest, errors: [], path: manifestPath };
|
|
491
533
|
}
|
|
492
534
|
|
|
493
|
-
function parsePackageManager(spec) {
|
|
535
|
+
export function parsePackageManager(spec) {
|
|
494
536
|
const match = /^(pnpm|npm|yarn)@(\d+\.\d+\.\d+)$/.exec(spec);
|
|
495
537
|
if (!match) throw new Error(`invalid packageManager spec: ${spec}`);
|
|
496
538
|
const [, name, version] = match;
|
|
@@ -554,7 +596,7 @@ function signingMatrix(manifest, platform) {
|
|
|
554
596
|
}
|
|
555
597
|
|
|
556
598
|
const AZURE_LOGIN_SHA = "7ddb5af1ef8758cf1353cf3b42f940aee27ba21c"; // v3
|
|
557
|
-
const DOWNLOAD_ARTIFACT_SHA = "d3f86a106a0bac45b974a628896c90dbdf5c8093"; // v4.3.0
|
|
599
|
+
export const DOWNLOAD_ARTIFACT_SHA = "d3f86a106a0bac45b974a628896c90dbdf5c8093"; // v4.3.0
|
|
558
600
|
const UPLOAD_ARTIFACT_SHA = "ea165f8d65b6e75b540449e92b4886f43607fa02"; // v4
|
|
559
601
|
const ARTIFACT_SIGNING_CLIENT_VERSION = "1.0.128";
|
|
560
602
|
const ARTIFACT_SIGNING_CLIENT_SHA256 = "74BD7D27E6CE1051409C38D9B46BC8DF0400ECD643D51FFBF2AC00869061E40B";
|
|
@@ -607,6 +649,36 @@ function validateRegenerate(manifest, lanes, errors) {
|
|
|
607
649
|
}
|
|
608
650
|
}
|
|
609
651
|
|
|
652
|
+
// The sign-existing lane (rust-hybrid, Orthic-Labs/rightkit#257) is manual-only: it verifies an already-qualified
|
|
653
|
+
// artifact of another run of this repository and signs it per file with right-release sign-dev-artifact. It never builds.
|
|
654
|
+
const SIGN_EXISTING_ENVIRONMENT_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
|
|
655
|
+
|
|
656
|
+
function validateSignExisting(manifest, lanes, errors) {
|
|
657
|
+
const sign = manifest.signExisting;
|
|
658
|
+
const hasLane = Array.isArray(lanes) && lanes.includes("sign-existing");
|
|
659
|
+
if (sign === undefined) {
|
|
660
|
+
if (hasLane) errors.push("lane 'sign-existing' requires signExisting { macSignManifest, macPayloadMetadata }");
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (sign === null || typeof sign !== "object" || Array.isArray(sign)) {
|
|
664
|
+
errors.push("signExisting must be an object");
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (!hasLane) errors.push("signExisting requires lane 'sign-existing'");
|
|
668
|
+
for (const key of Object.keys(sign)) {
|
|
669
|
+
if (!["macSignManifest", "macPayloadMetadata", "macPayloadMetadataSource", "environment"].includes(key)) errors.push(`unknown signExisting field: ${key}`);
|
|
670
|
+
}
|
|
671
|
+
if (sign.macPayloadMetadataSource !== undefined) {
|
|
672
|
+
if (typeof sign.macPayloadMetadataSource !== "string" || !GATE_PATH_RE.test(sign.macPayloadMetadataSource)) errors.push("signExisting.macPayloadMetadataSource must be a safe repository-relative path to the generated payload metadata file");
|
|
673
|
+
if (typeof sign.macPayloadMetadata === "string" && sign.macPayloadMetadata.includes("/")) errors.push("signExisting.macPayloadMetadataSource places the file at the inner-zip root, so signExisting.macPayloadMetadata must be a bare file name");
|
|
674
|
+
if (!["sign", "notarize", "unsigned"].includes(manifest.devArtifact?.mac)) errors.push("signExisting.macPayloadMetadataSource needs devArtifact.mac 'sign', 'notarize' or 'unsigned' (the unsigned packaging step zips it)");
|
|
675
|
+
}
|
|
676
|
+
if (typeof sign.macSignManifest !== "string" || !GATE_PATH_RE.test(sign.macSignManifest)) errors.push("signExisting.macSignManifest must be a safe repository-relative path to a sign manifest JSON");
|
|
677
|
+
if (typeof sign.macPayloadMetadata !== "string" || !DEV_MAC_PATH_RE.test(sign.macPayloadMetadata)) errors.push("signExisting.macPayloadMetadata must be a safe path inside the artifact archive");
|
|
678
|
+
if (sign.environment !== undefined && (typeof sign.environment !== "string" || !SIGN_EXISTING_ENVIRONMENT_RE.test(sign.environment))) errors.push("signExisting.environment must be one safe environment name (letters, digits, '.', '_', '-')");
|
|
679
|
+
if (!Array.isArray(manifest.matrix?.os) || !manifest.matrix.os.some((runner) => typeof runner === "string" && MACOS_RUNNER_RE.test(runner))) errors.push("signExisting needs a macOS runner (macos-* or xcode-*) in matrix.os");
|
|
680
|
+
}
|
|
681
|
+
|
|
610
682
|
// swift.privatePackages (ci, qualification, release-candidate and regenerate lanes;
|
|
611
683
|
// the parallel dev-artifact-mac job): read access to private Swift package
|
|
612
684
|
// mirrors from a public repository's CI. The secret is a GitHub Actions secret
|
|
@@ -614,13 +686,34 @@ function validateRegenerate(manifest, lanes, errors) {
|
|
|
614
686
|
const SWIFT_PRIVATE_MAX_ENTRIES = 4;
|
|
615
687
|
// Lanes whose workflows carry the configure and cleanup steps. package-smoke,
|
|
616
688
|
// publish-npm and publish-package-managers never do (clean-room or credentialed jobs).
|
|
617
|
-
const SWIFT_PRIVATE_LANES = ["ci", "qualification", "release-candidate", "regenerate"];
|
|
689
|
+
const SWIFT_PRIVATE_LANES = ["ci", "qualification", "release-candidate", "regenerate", "swift-check"];
|
|
618
690
|
const SWIFT_PRIVATE_HOST_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,62})(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,62}))*$/;
|
|
619
691
|
|
|
620
692
|
function isSwiftPrivateSecretName(value) {
|
|
621
693
|
return typeof value === "string" && /^[A-Za-z_][A-Za-z0-9_]{0,99}$/.test(value) && !/^github_/i.test(value);
|
|
622
694
|
}
|
|
623
695
|
|
|
696
|
+
// All fields reach shell/YAML literally: reject expressions, whitespace, traversal and option syntax.
|
|
697
|
+
function validateSwiftCheck(check, lanes, errors) {
|
|
698
|
+
if (check === null || typeof check !== "object" || Array.isArray(check)) {
|
|
699
|
+
errors.push("swift.check must be an object");
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const fields = ["runner", "xcodeVersion", "projectDirectory", "spec", "project", "scheme", "xcodegenVersion"];
|
|
703
|
+
for (const key of Object.keys(check)) if (!fields.includes(key)) errors.push(`unknown swift.check field: ${key}`);
|
|
704
|
+
if (!lanes.includes("swift-check")) errors.push("swift.check requires lane 'swift-check'");
|
|
705
|
+
if (!["macos-15", "macos-15-intel", "macos-26"].includes(check.runner)) errors.push("swift.check.runner must be a pinned GitHub-hosted macOS runner: macos-15, macos-15-intel or macos-26");
|
|
706
|
+
for (const key of ["xcodeVersion", "xcodegenVersion"]) {
|
|
707
|
+
const pattern = key === "xcodegenVersion" ? /^\d+\.\d+\.\d+$/ : /^\d+\.\d+(?:\.\d+)?$/;
|
|
708
|
+
if (typeof check[key] !== "string" || !pattern.test(check[key])) errors.push(`swift.check.${key} must be an exact numeric version`);
|
|
709
|
+
}
|
|
710
|
+
if (typeof check.projectDirectory !== "string" || !RUST_WORKSPACE_PATH_RE.test(check.projectDirectory)) errors.push("swift.check.projectDirectory must be a safe relative directory or '.'");
|
|
711
|
+
for (const [key, extension] of [["spec", /\.ya?ml$/], ["project", /\.xcodeproj$/]]) {
|
|
712
|
+
if (typeof check[key] !== "string" || !GATE_PATH_RE.test(check[key]) || !extension.test(check[key])) errors.push(`swift.check.${key} must be a safe relative ${key === "spec" ? "YAML spec" : "xcodeproj"} path`);
|
|
713
|
+
}
|
|
714
|
+
if (typeof check.scheme !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(check.scheme)) errors.push("swift.check.scheme must be one safe scheme name");
|
|
715
|
+
}
|
|
716
|
+
|
|
624
717
|
function validateSwift(manifest, lanes, errors) {
|
|
625
718
|
const swift = manifest.swift;
|
|
626
719
|
if (swift === null || typeof swift !== "object" || Array.isArray(swift)) {
|
|
@@ -628,8 +721,10 @@ function validateSwift(manifest, lanes, errors) {
|
|
|
628
721
|
return;
|
|
629
722
|
}
|
|
630
723
|
for (const key of Object.keys(swift)) {
|
|
631
|
-
if (key !== "privatePackages") errors.push(`unknown swift field: ${key}`);
|
|
724
|
+
if (key !== "privatePackages" && key !== "check") errors.push(`unknown swift field: ${key}`);
|
|
632
725
|
}
|
|
726
|
+
if (swift.check !== undefined) validateSwiftCheck(swift.check, lanes, errors);
|
|
727
|
+
if (swift.privatePackages === undefined && swift.check !== undefined) return;
|
|
633
728
|
const entries = swift.privatePackages;
|
|
634
729
|
if (!Array.isArray(entries) || entries.length === 0 || entries.length > SWIFT_PRIVATE_MAX_ENTRIES) {
|
|
635
730
|
errors.push(`swift.privatePackages must be an array of 1 to ${SWIFT_PRIVATE_MAX_ENTRIES} { host, secret } entries`);
|
|
@@ -673,7 +768,7 @@ function validateDevArtifact(manifest, profile, errors) {
|
|
|
673
768
|
return;
|
|
674
769
|
}
|
|
675
770
|
for (const key of Object.keys(dev)) {
|
|
676
|
-
if (!["mac", "windows", "retentionDays", "macAppPath", "macEntitlements", "windowsGlob", "dispatch", "parallel", "buildScript"].includes(key)) errors.push(`unknown devArtifact field: ${key}`);
|
|
771
|
+
if (!["mac", "windows", "retentionDays", "macAppPath", "macEntitlements", "macSignManifest", "macPayloadMetadata", "windowsGlob", "dispatch", "parallel", "buildScript"].includes(key)) errors.push(`unknown devArtifact field: ${key}`);
|
|
677
772
|
}
|
|
678
773
|
if (dev.mac !== undefined && !["sign", "notarize", "unsigned", "none"].includes(dev.mac)) errors.push("devArtifact.mac must be 'sign', 'notarize', 'unsigned' or 'none'");
|
|
679
774
|
if (dev.windows !== undefined && dev.windows !== "unsigned" && dev.windows !== "none") errors.push("devArtifact.windows must be 'unsigned' or 'none'");
|
|
@@ -704,13 +799,21 @@ function validateDevArtifact(manifest, profile, errors) {
|
|
|
704
799
|
} else if (dev.macEntitlements !== undefined && (typeof dev.macEntitlements !== "string" || !GATE_PATH_RE.test(dev.macEntitlements))) {
|
|
705
800
|
errors.push("devArtifact.macEntitlements must be a safe repository-relative path");
|
|
706
801
|
}
|
|
802
|
+
if (dev.macSignManifest !== undefined) {
|
|
803
|
+
if (dev.mac !== "sign") errors.push("devArtifact.macSignManifest requires mac 'sign' (the per-file lane never notarizes)");
|
|
804
|
+
if (typeof dev.macSignManifest !== "string" || !GATE_PATH_RE.test(dev.macSignManifest)) errors.push("devArtifact.macSignManifest must be a safe repository-relative path to a sign manifest JSON");
|
|
805
|
+
if (dev.macEntitlements !== undefined) errors.push("devArtifact.macSignManifest and macEntitlements cannot be combined; per-file entitlements go in the sign manifest");
|
|
806
|
+
if (typeof dev.macPayloadMetadata !== "string" || !DEV_MAC_PATH_RE.test(dev.macPayloadMetadata)) errors.push("devArtifact.macPayloadMetadata (a safe path inside the staged archive) is required with macSignManifest");
|
|
807
|
+
} else if (dev.macPayloadMetadata !== undefined) {
|
|
808
|
+
errors.push("devArtifact.macPayloadMetadata requires macSignManifest");
|
|
809
|
+
}
|
|
707
810
|
if (!runners.some((runner) => MACOS_RUNNER_RE.test(runner))) {
|
|
708
811
|
errors.push(dev.parallel === true
|
|
709
812
|
? `devArtifact.mac '${dev.mac}' needs a macOS runner (macos-* or xcode-*) in matrix.os`
|
|
710
813
|
: `devArtifact.mac '${dev.mac}' needs the ci gate to run on a macOS runner (set ciAllOs and include a macos-* or xcode-* runner in matrix.os)`);
|
|
711
814
|
}
|
|
712
|
-
} else if (dev.macAppPath !== undefined || dev.macEntitlements !== undefined) {
|
|
713
|
-
errors.push("devArtifact.macAppPath and
|
|
815
|
+
} else if (dev.macAppPath !== undefined || dev.macEntitlements !== undefined || dev.macSignManifest !== undefined || dev.macPayloadMetadata !== undefined) {
|
|
816
|
+
errors.push("devArtifact.macAppPath, macEntitlements, macSignManifest and macPayloadMetadata require mac 'sign', 'notarize' or 'unsigned'");
|
|
714
817
|
}
|
|
715
818
|
if (dev.windows === "unsigned") {
|
|
716
819
|
if (typeof dev.windowsGlob !== "string" || !DEV_WINDOWS_GLOB_RE.test(dev.windowsGlob)) {
|
|
@@ -732,6 +835,63 @@ const DEV_PUSH_CONDITION = "github.event_name == 'push' && github.ref_name == gi
|
|
|
732
835
|
// PR runs keep cancel-in-progress true, so superseded PR runs still cancel.
|
|
733
836
|
const CONCURRENCY_MAIN_PUSHES = ["cancel", "queue"];
|
|
734
837
|
const CI_CANCEL_MAIN_QUEUE_EXPRESSION = "${{ !(github.event_name == 'push' && github.ref_name == github.event.repository.default_branch) }}";
|
|
838
|
+
const CI_GROUP_PER_REF = "${{ github.workflow }}-${{ github.ref }}";
|
|
839
|
+
// A default-branch push gets a group of its own (never queued or cancelled at workflow level, so its
|
|
840
|
+
// `supersede` job always runs); every other event keeps one group per ref.
|
|
841
|
+
const CI_GROUP_SUPERSEDE = "${{ github.workflow }}-${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && github.run_id || github.ref }}";
|
|
842
|
+
const SUPERSEDE_SCRIPT_PATH = new URL("./supersede.mjs", import.meta.url);
|
|
843
|
+
const SUPERSEDE_HEREDOC_END = "RIGHT_GIT_SUPERSEDE_EOF";
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* The `ci` (rust-hybrid) / `test` (node) job's own concurrency group. Default-branch pushes share one
|
|
847
|
+
* group per matrix leg with cancel-in-progress false, so a newer run waits for an older run that
|
|
848
|
+
* `supersede` chose to keep: never two runs in progress. Every other event gets a group unique to the
|
|
849
|
+
* run, so pull requests are not serialised against main.
|
|
850
|
+
*/
|
|
851
|
+
function ciJobConcurrency() {
|
|
852
|
+
return [
|
|
853
|
+
" concurrency:",
|
|
854
|
+
" group: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && format('{0}-main-{1}-{2}', github.workflow, matrix.os, matrix.node) || format('{0}-{1}-{2}-{3}-{4}', github.workflow, github.run_id, github.run_attempt, matrix.os, matrix.node) }}",
|
|
855
|
+
" cancel-in-progress: false",
|
|
856
|
+
"",
|
|
857
|
+
].join("\n");
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* The `supersede` job: the only job in a managed workflow with `actions: write`. It runs the shipped
|
|
862
|
+
* supersede.mjs (embedded verbatim; pure decision function tested in supersede.test.mjs) and cancels
|
|
863
|
+
* older runs of this workflow on the default branch that only just started or are already failing.
|
|
864
|
+
* `right-git-ci-only` in @rightkit/release accepts `actions: write` only in this exact job shape.
|
|
865
|
+
*/
|
|
866
|
+
function supersedeJob(manifest) {
|
|
867
|
+
const concurrency = manifest.concurrency ?? {};
|
|
868
|
+
const script = fs.readFileSync(SUPERSEDE_SCRIPT_PATH, "utf8").replace(/\r\n?/g, "\n").replace(/\n+$/, "");
|
|
869
|
+
const indent = (text) => text.split("\n").map((line) => (line === "" ? "" : ` ${line}`)).join("\n");
|
|
870
|
+
return [
|
|
871
|
+
" supersede:",
|
|
872
|
+
" needs: [private-repo-guard]",
|
|
873
|
+
" if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}",
|
|
874
|
+
" runs-on: ubuntu-24.04",
|
|
875
|
+
" timeout-minutes: 5",
|
|
876
|
+
" permissions:",
|
|
877
|
+
" contents: read",
|
|
878
|
+
" actions: write",
|
|
879
|
+
" steps:",
|
|
880
|
+
" - name: Cancel superseded runs that only just started or are failing",
|
|
881
|
+
" shell: bash",
|
|
882
|
+
" env:",
|
|
883
|
+
" GH_TOKEN: ${{ github.token }}",
|
|
884
|
+
` RIGHT_GIT_GRACE_FRACTION: "${concurrency.graceFraction ?? 0.7}"`,
|
|
885
|
+
` RIGHT_GIT_MEDIAN_WINDOW: "${concurrency.medianWindow ?? 10}"`,
|
|
886
|
+
" run: |",
|
|
887
|
+
" set -euo pipefail",
|
|
888
|
+
` cat > "$RUNNER_TEMP/supersede.mjs" <<'${SUPERSEDE_HEREDOC_END}'`,
|
|
889
|
+
indent(script),
|
|
890
|
+
` ${SUPERSEDE_HEREDOC_END}`,
|
|
891
|
+
' node "$RUNNER_TEMP/supersede.mjs"',
|
|
892
|
+
"",
|
|
893
|
+
].join("\n");
|
|
894
|
+
}
|
|
735
895
|
// rustCache.keySuffix: charset-checked before it reaches the rendered `key` input.
|
|
736
896
|
const RUST_CACHE_KEY_SUFFIX_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
737
897
|
|
|
@@ -742,11 +902,31 @@ function validateConcurrency(manifest, lanes, errors) {
|
|
|
742
902
|
return;
|
|
743
903
|
}
|
|
744
904
|
for (const key of Object.keys(concurrency)) {
|
|
745
|
-
if (
|
|
905
|
+
if (!["mainPushes", "reason", "graceFraction", "medianWindow"].includes(key)) errors.push(`unknown concurrency field: ${key}`);
|
|
906
|
+
}
|
|
907
|
+
if (concurrency.graceFraction !== undefined
|
|
908
|
+
&& !(typeof concurrency.graceFraction === "number" && concurrency.graceFraction > 0 && concurrency.graceFraction <= 1)) {
|
|
909
|
+
errors.push("concurrency.graceFraction must be a number above 0 and at most 1");
|
|
910
|
+
}
|
|
911
|
+
if (concurrency.medianWindow !== undefined
|
|
912
|
+
&& !(Number.isInteger(concurrency.medianWindow) && concurrency.medianWindow >= 1 && concurrency.medianWindow <= 100)) {
|
|
913
|
+
errors.push("concurrency.medianWindow must be an integer from 1 to 100");
|
|
914
|
+
}
|
|
915
|
+
if (concurrency.mainPushes === "queue" && (concurrency.graceFraction !== undefined || concurrency.medianWindow !== undefined)) {
|
|
916
|
+
errors.push("concurrency.graceFraction and concurrency.medianWindow apply only to the default supersede rule, not mainPushes 'queue'");
|
|
746
917
|
}
|
|
747
918
|
if (concurrency.mainPushes !== undefined && !CONCURRENCY_MAIN_PUSHES.includes(concurrency.mainPushes)) {
|
|
748
919
|
errors.push("concurrency.mainPushes must be 'cancel' or 'queue'");
|
|
749
920
|
}
|
|
921
|
+
if (concurrency.mainPushes === "queue") {
|
|
922
|
+
if (typeof concurrency.reason !== "string" || concurrency.reason.trim() === "") {
|
|
923
|
+
errors.push("concurrency.mainPushes 'queue' requires a non-empty concurrency.reason");
|
|
924
|
+
} else if (/[\r\n\u0085\u2028\u2029]/.test(concurrency.reason)) {
|
|
925
|
+
errors.push("concurrency.reason must be a single line");
|
|
926
|
+
}
|
|
927
|
+
} else if (concurrency.reason !== undefined) {
|
|
928
|
+
errors.push("concurrency.reason is only allowed with concurrency.mainPushes 'queue'");
|
|
929
|
+
}
|
|
750
930
|
if (!Array.isArray(lanes) || !lanes.includes("ci")) {
|
|
751
931
|
errors.push("concurrency requires lane 'ci' (it sets the ci workflow's concurrency)");
|
|
752
932
|
}
|
|
@@ -827,7 +1007,7 @@ export function devArtifactCi(manifest, options = {}) {
|
|
|
827
1007
|
" set -euo pipefail",
|
|
828
1008
|
" test -d \"$DEV_APP_PATH\"",
|
|
829
1009
|
" mkdir -p \"$RUNNER_TEMP/dev-unsigned\"",
|
|
830
|
-
|
|
1010
|
+
...devMacZipLines(manifest),
|
|
831
1011
|
" - name: Upload unsigned dev app for signing (macOS)",
|
|
832
1012
|
` if: \${{ ${DEV_PUSH_CONDITION} && runner.os == 'macOS' }}`,
|
|
833
1013
|
` uses: ${UPLOAD_ARTIFACT_PIN}`,
|
|
@@ -850,7 +1030,7 @@ export function devArtifactCi(manifest, options = {}) {
|
|
|
850
1030
|
" set -euo pipefail",
|
|
851
1031
|
" test -d \"$DEV_APP_PATH\"",
|
|
852
1032
|
" mkdir -p \"$RUNNER_TEMP/dev-unsigned\"",
|
|
853
|
-
|
|
1033
|
+
...devMacZipLines(manifest),
|
|
854
1034
|
" - name: Upload unsigned dev app (macOS)",
|
|
855
1035
|
` if: \${{ ${unsignedCondition} && runner.os == 'macOS' }}`,
|
|
856
1036
|
` uses: ${UPLOAD_ARTIFACT_PIN}`,
|
|
@@ -891,6 +1071,23 @@ function firstMatchingRunner(manifest, pattern, platform) {
|
|
|
891
1071
|
return runner;
|
|
892
1072
|
}
|
|
893
1073
|
|
|
1074
|
+
// The line that zips the built .app into the inner zip. With `signExisting.macPayloadMetadataSource` set, the .app (wrapper layout
|
|
1075
|
+
// preserved, ditto) and the generated payload metadata file are staged together and zipped so the file sits at the inner-zip root
|
|
1076
|
+
// under the basename of `macPayloadMetadata`; a missing file fails the step. Unset, the single original line renders, byte-identical.
|
|
1077
|
+
function devMacZipLines(manifest) {
|
|
1078
|
+
const source = manifest.signExisting?.macPayloadMetadataSource;
|
|
1079
|
+
if (typeof source !== "string") return [' ditto -c -k --keepParent "$DEV_APP_PATH" "$RUNNER_TEMP/dev-unsigned/app.zip"'];
|
|
1080
|
+
const name = path.posix.basename(manifest.signExisting.macPayloadMetadata);
|
|
1081
|
+
return [
|
|
1082
|
+
` test -f ${JSON.stringify(source)}`,
|
|
1083
|
+
' stage="$RUNNER_TEMP/dev-unsigned-stage"',
|
|
1084
|
+
' rm -rf "$stage" && mkdir -p "$stage"',
|
|
1085
|
+
' ditto "$DEV_APP_PATH" "$stage/$(basename "$DEV_APP_PATH")"',
|
|
1086
|
+
` cp ${JSON.stringify(source)} "$stage/${name}"`,
|
|
1087
|
+
' ditto -c -k "$stage" "$RUNNER_TEMP/dev-unsigned/app.zip"',
|
|
1088
|
+
];
|
|
1089
|
+
}
|
|
1090
|
+
|
|
894
1091
|
function devMacArtifactJob({ manifest, lane, artifactPrefix, retention }) {
|
|
895
1092
|
const dev = manifest.devArtifact;
|
|
896
1093
|
const signed = dev.mac === "sign" || dev.mac === "notarize";
|
|
@@ -903,7 +1100,7 @@ function devMacArtifactJob({ manifest, lane, artifactPrefix, retention }) {
|
|
|
903
1100
|
" set -euo pipefail",
|
|
904
1101
|
" test -d \"$DEV_APP_PATH\"",
|
|
905
1102
|
" mkdir -p \"$RUNNER_TEMP/dev-unsigned\"",
|
|
906
|
-
|
|
1103
|
+
...devMacZipLines(manifest),
|
|
907
1104
|
...(signed
|
|
908
1105
|
? [
|
|
909
1106
|
" - name: Upload unsigned dev app for signing (macOS)",
|
|
@@ -1020,13 +1217,35 @@ function devMacSigningJob(manifest, dev, retention) {
|
|
|
1020
1217
|
const parallel = dev.parallel === true;
|
|
1021
1218
|
const runner = (parallel ? manifest.matrix.os : effectiveCiRunners(manifest)).find((os) => MACOS_RUNNER_RE.test(os));
|
|
1022
1219
|
const entitlements = dev.macEntitlements ? ` --entitlements "$GITHUB_WORKSPACE/${dev.macEntitlements}"` : "";
|
|
1023
|
-
|
|
1220
|
+
// `macSignManifest`: sign each file with its fixed identifier through `right-release sign-dev-artifact`
|
|
1221
|
+
// (Orthic-Labs/rightkit#257) instead of `codesign --deep` on the .app. It needs the repo (the manifest) and the
|
|
1222
|
+
// installed right-release; unset, none of this renders and the --deep lane is byte-identical.
|
|
1223
|
+
const perFile = typeof dev.macSignManifest === "string";
|
|
1224
|
+
const pm = perFile ? parsePackageManager(manifest.packageManager) : null;
|
|
1225
|
+
const exec = pm ? { pnpm: "pnpm exec", npm: "npm exec --", yarn: "yarn exec" }[pm.name] : "";
|
|
1226
|
+
const checkout = dev.macEntitlements || perFile
|
|
1024
1227
|
? ` - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
1025
1228
|
with:
|
|
1026
1229
|
ref: \${{ github.sha }}
|
|
1027
1230
|
persist-credentials: false
|
|
1028
|
-
`
|
|
1231
|
+
${perFile ? ` - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
1232
|
+
with:
|
|
1233
|
+
node-version: ${String(manifest.matrix.node[0])}
|
|
1234
|
+
package-manager-cache: false
|
|
1235
|
+
${pm.setup ? `${pm.setup}\n` : ""} - run: ${pm.installCommand}
|
|
1236
|
+
` : ""}`
|
|
1029
1237
|
: "";
|
|
1238
|
+
const signLines = perFile
|
|
1239
|
+
? ` mkdir -p "$RUNNER_TEMP/dev-signed"
|
|
1240
|
+
${exec} right-release sign-dev-artifact --artifact "$work" --manifest "$GITHUB_WORKSPACE/${dev.macSignManifest}" --metadata "$work/${dev.macPayloadMetadata}" --evidence "$RUNNER_TEMP/dev-signed/sign-evidence.json"`
|
|
1241
|
+
: ` codesign --force --deep --strict --options runtime --timestamp${entitlements} --sign "$APPLE_DEVELOPER_ID" "$app"
|
|
1242
|
+
codesign --verify --deep --strict "$app"
|
|
1243
|
+
mkdir -p "$RUNNER_TEMP/dev-signed"`;
|
|
1244
|
+
const uploadPath = perFile
|
|
1245
|
+
? `|
|
|
1246
|
+
\${{ runner.temp }}/dev-signed/*.zip
|
|
1247
|
+
\${{ runner.temp }}/dev-signed/sign-evidence.json`
|
|
1248
|
+
: "${{ runner.temp }}/dev-signed/*.zip";
|
|
1030
1249
|
// `mac: "notarize"` also submits the signed app to the notary service and
|
|
1031
1250
|
// staples the ticket, so app extensions (Finder Sync, Share, ...) register on
|
|
1032
1251
|
// current macOS, which refuses them from unnotarized Developer ID apps.
|
|
@@ -1096,15 +1315,13 @@ ${checkout} - name: Download unsigned dev app
|
|
|
1096
1315
|
ditto -x -k "$RUNNER_TEMP/dev-unsigned/app.zip" "$work"
|
|
1097
1316
|
app="$(find "$work" -maxdepth 1 -name '*.app' -print -quit)"
|
|
1098
1317
|
test -n "$app"
|
|
1099
|
-
|
|
1100
|
-
codesign --verify --deep --strict "$app"
|
|
1101
|
-
mkdir -p "$RUNNER_TEMP/dev-signed"
|
|
1318
|
+
${signLines}
|
|
1102
1319
|
ditto -c -k --keepParent "$app" "$RUNNER_TEMP/dev-signed/$(basename "$app").zip"
|
|
1103
1320
|
${notarizeStep} - name: ${uploadLabel}
|
|
1104
1321
|
uses: ${UPLOAD_ARTIFACT_PIN}
|
|
1105
1322
|
with:
|
|
1106
1323
|
name: dev-mac-\${{ github.sha }}
|
|
1107
|
-
path:
|
|
1324
|
+
path: ${uploadPath}
|
|
1108
1325
|
retention-days: ${retention}
|
|
1109
1326
|
if-no-files-found: error
|
|
1110
1327
|
- name: Remove Apple signing material
|
|
@@ -1116,6 +1333,268 @@ ${notarizeStep} - name: ${uploadLabel}
|
|
|
1116
1333
|
`;
|
|
1117
1334
|
}
|
|
1118
1335
|
|
|
1336
|
+
// sign-existing lane job (Orthic-Labs/rightkit#257). Signs an already-qualified artifact of ANOTHER run; it never builds,
|
|
1337
|
+
// never passes --release, never notarizes. Run id, artifact and source sha arrive as workflow_dispatch inputs and reach the
|
|
1338
|
+
// shell only through env vars, after a format check. The keychain install and removal steps mirror devMacSigningJob exactly
|
|
1339
|
+
// (same secrets, same temporary keychain); keep the two in step. Bash here avoids a braced upper-case variable, which the
|
|
1340
|
+
// template engine would read as a placeholder.
|
|
1341
|
+
function signExistingJob(manifest) {
|
|
1342
|
+
const sign = manifest.signExisting;
|
|
1343
|
+
const runner = manifest.matrix.os.find((os) => MACOS_RUNNER_RE.test(os));
|
|
1344
|
+
const pm = parsePackageManager(manifest.packageManager);
|
|
1345
|
+
const exec = { pnpm: "pnpm exec", npm: "npm exec --", yarn: "yarn exec" }[pm.name];
|
|
1346
|
+
const environment = sign.environment ?? releaseEnvironment(manifest, "signing");
|
|
1347
|
+
return `
|
|
1348
|
+
sign-existing:
|
|
1349
|
+
# Default branch only: the signing code and sign manifest come from this revision, and the protected
|
|
1350
|
+
# environment's rules (required reviewers, branch policy) apply. Nothing here compiles the app.
|
|
1351
|
+
needs: [private-repo-guard]
|
|
1352
|
+
if: \${{ github.event_name == 'workflow_dispatch' && github.ref_name == github.event.repository.default_branch }}
|
|
1353
|
+
environment: ${environment}
|
|
1354
|
+
runs-on: ${runner}
|
|
1355
|
+
timeout-minutes: 30
|
|
1356
|
+
permissions:
|
|
1357
|
+
contents: read
|
|
1358
|
+
actions: read
|
|
1359
|
+
steps:
|
|
1360
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
1361
|
+
with:
|
|
1362
|
+
ref: \${{ github.sha }}
|
|
1363
|
+
fetch-depth: 0
|
|
1364
|
+
persist-credentials: false
|
|
1365
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
1366
|
+
with:
|
|
1367
|
+
node-version: ${String(manifest.matrix.node[0])}
|
|
1368
|
+
package-manager-cache: false
|
|
1369
|
+
${pm.setup ? `${pm.setup}\n` : ""} - run: ${pm.installCommand}${ownershipStep(manifest, "sign-existing")}
|
|
1370
|
+
- name: Verify the existing artifact belongs to this repository, run and source commit
|
|
1371
|
+
id: verify
|
|
1372
|
+
shell: bash
|
|
1373
|
+
env:
|
|
1374
|
+
GH_TOKEN: \${{ github.token }}
|
|
1375
|
+
INPUT_RUN_ID: \${{ inputs.run_id }}
|
|
1376
|
+
INPUT_ARTIFACT: \${{ inputs.artifact }}
|
|
1377
|
+
INPUT_SOURCE_SHA: \${{ inputs.source_sha }}
|
|
1378
|
+
run: |
|
|
1379
|
+
set -euo pipefail
|
|
1380
|
+
fail() { echo "sign-existing refused: $*" >&2; exit 1; }
|
|
1381
|
+
command -v jq >/dev/null || fail "jq is not available on this runner"
|
|
1382
|
+
[[ "$INPUT_RUN_ID" =~ ^[1-9][0-9]{0,19}$ ]] || fail "run_id must be a numeric workflow run id"
|
|
1383
|
+
[[ "$INPUT_ARTIFACT" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]] || fail "artifact must be a numeric artifact id or a plain artifact name"
|
|
1384
|
+
[[ "$INPUT_SOURCE_SHA" =~ ^[0-9a-f]{7,40}$ ]] || fail "source_sha must be 7 to 40 lowercase hexadecimal characters"
|
|
1385
|
+
run_json="$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$INPUT_RUN_ID")"
|
|
1386
|
+
run_id="$(jq -r '.id' <<<"$run_json")"
|
|
1387
|
+
run_repo="$(jq -r '.repository.full_name' <<<"$run_json")"
|
|
1388
|
+
run_repo_id="$(jq -r '.repository.id' <<<"$run_json")"
|
|
1389
|
+
head_repo="$(jq -r '.head_repository.full_name // empty' <<<"$run_json")"
|
|
1390
|
+
head_repo_id="$(jq -r '.head_repository.id // empty' <<<"$run_json")"
|
|
1391
|
+
head_sha="$(jq -r '.head_sha' <<<"$run_json")"
|
|
1392
|
+
status="$(jq -r '.status' <<<"$run_json")"
|
|
1393
|
+
conclusion="$(jq -r '.conclusion // empty' <<<"$run_json")"
|
|
1394
|
+
[ "$run_id" = "$INPUT_RUN_ID" ] || fail "run id mismatch"
|
|
1395
|
+
[ "$run_repo" = "$GITHUB_REPOSITORY" ] || fail "run $INPUT_RUN_ID belongs to $run_repo, not $GITHUB_REPOSITORY"
|
|
1396
|
+
[ "$head_repo" = "$GITHUB_REPOSITORY" ] && [ "$head_repo_id" = "$run_repo_id" ] || fail "run $INPUT_RUN_ID was built from another repository or a fork"
|
|
1397
|
+
[ "$status" = completed ] && [ "$conclusion" = success ] || fail "run $INPUT_RUN_ID is $status/$conclusion, not a successful completed run"
|
|
1398
|
+
[[ "$head_sha" =~ ^[0-9a-f]{40}$ ]] || fail "run head sha is not a full commit sha"
|
|
1399
|
+
case "$head_sha" in "$INPUT_SOURCE_SHA"*) ;; *) fail "run $INPUT_RUN_ID head sha $head_sha does not start with source_sha $INPUT_SOURCE_SHA" ;; esac
|
|
1400
|
+
artifacts_json="$(gh api --paginate "repos/$GITHUB_REPOSITORY/actions/runs/$INPUT_RUN_ID/artifacts?per_page=100" | jq -s '[.[].artifacts[]]')"
|
|
1401
|
+
if [[ "$INPUT_ARTIFACT" =~ ^[0-9]+$ ]]; then
|
|
1402
|
+
picked="$(jq -c --argjson id "$INPUT_ARTIFACT" '[.[] | select(.id == $id)]' <<<"$artifacts_json")"
|
|
1403
|
+
else
|
|
1404
|
+
picked="$(jq -c --arg name "$INPUT_ARTIFACT" '[.[] | select(.name == $name)]' <<<"$artifacts_json")"
|
|
1405
|
+
fi
|
|
1406
|
+
[ "$(jq 'length' <<<"$picked")" = 1 ] || fail "artifact $INPUT_ARTIFACT is not exactly one artifact of run $INPUT_RUN_ID"
|
|
1407
|
+
artifact_id="$(jq -r '.[0].id' <<<"$picked")"
|
|
1408
|
+
artifact_name="$(jq -r '.[0].name' <<<"$picked")"
|
|
1409
|
+
[ "$(jq -r '.[0].expired' <<<"$picked")" = false ] || fail "artifact $artifact_name has expired"
|
|
1410
|
+
[ "$(jq -r '.[0].workflow_run.id' <<<"$picked")" = "$INPUT_RUN_ID" ] || fail "artifact $artifact_name belongs to another run"
|
|
1411
|
+
[ "$(jq -r '.[0].workflow_run.head_sha' <<<"$picked")" = "$head_sha" ] || fail "artifact $artifact_name was built from another commit"
|
|
1412
|
+
[ "$(jq -r '.[0].workflow_run.head_repository_id' <<<"$picked")" = "$run_repo_id" ] || fail "artifact $artifact_name was built from another repository"
|
|
1413
|
+
[[ "$artifact_name" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]] || fail "artifact name is not a plain name"
|
|
1414
|
+
git cat-file -e "$head_sha^{commit}" 2>/dev/null || fail "source commit $head_sha is not in this repository's history"
|
|
1415
|
+
git merge-base --is-ancestor "$head_sha" "$GITHUB_SHA" || fail "source commit $head_sha is not an ancestor of the signing revision $GITHUB_SHA"
|
|
1416
|
+
mkdir -p "$RUNNER_TEMP/dev-signed"
|
|
1417
|
+
jq -n --arg repo "$GITHUB_REPOSITORY" --arg run "$run_id" --argjson artifactId "$artifact_id" --arg artifactName "$artifact_name" --arg sourceSha "$head_sha" --arg requested "$INPUT_SOURCE_SHA" --arg signingRevision "$GITHUB_SHA" '{schema: 1, repository: $repo, runId: $run, artifactId: $artifactId, artifactName: $artifactName, sourceSha: $sourceSha, requestedSourceSha: $requested, signingRevision: $signingRevision}' > "$RUNNER_TEMP/dev-signed/source-verification.json"
|
|
1418
|
+
{
|
|
1419
|
+
printf 'run_id=%s\\n' "$run_id"
|
|
1420
|
+
printf 'artifact_id=%s\\n' "$artifact_id"
|
|
1421
|
+
printf 'artifact_name=%s\\n' "$artifact_name"
|
|
1422
|
+
printf 'head_sha=%s\\n' "$head_sha"
|
|
1423
|
+
} >> "$GITHUB_OUTPUT"
|
|
1424
|
+
- name: Download the verified artifact
|
|
1425
|
+
uses: actions/download-artifact@${DOWNLOAD_ARTIFACT_SHA} # v4.3.0
|
|
1426
|
+
with:
|
|
1427
|
+
name: \${{ steps.verify.outputs.artifact_name }}
|
|
1428
|
+
run-id: \${{ steps.verify.outputs.run_id }}
|
|
1429
|
+
repository: \${{ github.repository }}
|
|
1430
|
+
github-token: \${{ github.token }}
|
|
1431
|
+
path: \${{ runner.temp }}/existing-artifact
|
|
1432
|
+
- name: Install Apple signing identity in temporary keychain
|
|
1433
|
+
shell: bash
|
|
1434
|
+
env:
|
|
1435
|
+
APPLE_CERTIFICATE_BASE64: \${{ secrets.APPLE_CERTIFICATE_BASE64 }}
|
|
1436
|
+
APPLE_CERTIFICATE_PASSWORD: \${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
1437
|
+
APPLE_KEYCHAIN_PASSWORD: \${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
|
|
1438
|
+
run: |
|
|
1439
|
+
set -euo pipefail
|
|
1440
|
+
certificate_path="$RUNNER_TEMP/apple-signing.p12"
|
|
1441
|
+
keychain_path="$RUNNER_TEMP/apple-signing.keychain-db"
|
|
1442
|
+
printf '%s' "$APPLE_CERTIFICATE_BASE64" | base64 --decode > "$certificate_path"
|
|
1443
|
+
security create-keychain -p "$APPLE_KEYCHAIN_PASSWORD" "$keychain_path"
|
|
1444
|
+
security set-keychain-settings -lut 21600 "$keychain_path"
|
|
1445
|
+
security unlock-keychain -p "$APPLE_KEYCHAIN_PASSWORD" "$keychain_path"
|
|
1446
|
+
security import "$certificate_path" -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$keychain_path"
|
|
1447
|
+
security set-key-partition-list -S apple-tool:,apple: -k "$APPLE_KEYCHAIN_PASSWORD" "$keychain_path"
|
|
1448
|
+
security list-keychain -d user -s "$keychain_path"
|
|
1449
|
+
- name: Developer ID sign existing artifact (no rebuild, no notarization)
|
|
1450
|
+
shell: bash
|
|
1451
|
+
env:
|
|
1452
|
+
APPLE_DEVELOPER_ID: \${{ vars.APPLE_DEVELOPER_ID }}
|
|
1453
|
+
run: |
|
|
1454
|
+
set -euo pipefail
|
|
1455
|
+
downloaded="$RUNNER_TEMP/existing-artifact"
|
|
1456
|
+
work="$RUNNER_TEMP/dev-sign"
|
|
1457
|
+
rm -rf "$work" && mkdir -p "$work" "$RUNNER_TEMP/dev-signed"
|
|
1458
|
+
zips=()
|
|
1459
|
+
while IFS= read -r -d '' file; do zips+=("$file"); done < <(find "$downloaded" -type f -name '*.zip' -print0)
|
|
1460
|
+
if [ "\${#zips[@]}" -eq 1 ]; then
|
|
1461
|
+
ditto -x -k "\${zips[0]}" "$work"
|
|
1462
|
+
out="$(basename "\${zips[0]}")"
|
|
1463
|
+
elif [ "\${#zips[@]}" -eq 0 ]; then
|
|
1464
|
+
ditto "$downloaded" "$work"
|
|
1465
|
+
out="signed-artifact.zip"
|
|
1466
|
+
else
|
|
1467
|
+
echo "sign-existing refused: the artifact holds more than one zip" >&2
|
|
1468
|
+
exit 1
|
|
1469
|
+
fi
|
|
1470
|
+
${exec} right-release sign-dev-artifact --artifact "$work" --manifest "$GITHUB_WORKSPACE/${sign.macSignManifest}" --metadata "$work/${sign.macPayloadMetadata}" --evidence "$RUNNER_TEMP/dev-signed/sign-evidence.json"
|
|
1471
|
+
ditto -c -k "$work" "$RUNNER_TEMP/dev-signed/$out"
|
|
1472
|
+
- name: Upload signed existing artifact
|
|
1473
|
+
uses: ${UPLOAD_ARTIFACT_PIN}
|
|
1474
|
+
with:
|
|
1475
|
+
name: signed-\${{ steps.verify.outputs.artifact_name }}-\${{ steps.verify.outputs.head_sha }}
|
|
1476
|
+
path: |
|
|
1477
|
+
\${{ runner.temp }}/dev-signed/*.zip
|
|
1478
|
+
\${{ runner.temp }}/dev-signed/sign-evidence.json
|
|
1479
|
+
\${{ runner.temp }}/dev-signed/source-verification.json
|
|
1480
|
+
retention-days: ${DEV_ARTIFACT_DEFAULT_RETENTION_DAYS}
|
|
1481
|
+
if-no-files-found: error
|
|
1482
|
+
- name: Remove Apple signing material
|
|
1483
|
+
if: \${{ always() }}
|
|
1484
|
+
shell: bash
|
|
1485
|
+
run: |
|
|
1486
|
+
security delete-keychain "$RUNNER_TEMP/apple-signing.keychain-db" 2>/dev/null || true
|
|
1487
|
+
rm -f "$RUNNER_TEMP/apple-signing.p12"
|
|
1488
|
+
`;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
// A configured dev-qualification job gates both signing jobs: a failed or
|
|
1492
|
+
// skipped dev qualification leaves signing skipped (neither signing job uses
|
|
1493
|
+
// always()). Unconfigured, the list is byte-identical to the original.
|
|
1494
|
+
function signingNeeds(manifest) {
|
|
1495
|
+
return manifest.candidate?.devQualification ? "[admission, candidate, dev-qualification]" : "[admission, candidate]";
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// Optional lane (Orthic-Labs/rightkit#107): builds the DEV build (QA surface on)
|
|
1499
|
+
// from the same admitted source_revision and runs the app's in-app journeys
|
|
1500
|
+
// against it. Never touches candidate or signed bytes; the signed candidate stays
|
|
1501
|
+
// QA-free and is qualified from outside by installed-qualification.
|
|
1502
|
+
function devQualificationJob(manifest, pm, artifactPrefix, cacheKeyLine) {
|
|
1503
|
+
const dev = manifest.candidate?.devQualification;
|
|
1504
|
+
if (!dev) return "";
|
|
1505
|
+
const root = `\${{ runner.temp }}/${manifest.candidate.artifactRoot}-devqual`;
|
|
1506
|
+
const identity = `\${{ needs.admission.outputs.version }}-\${{ needs.admission.outputs.source_revision }}\${{ needs.admission.outputs.artifact_suffix }}`;
|
|
1507
|
+
const stageEnv = (action, extra = "") => ` RIGHT_GIT_STAGE_ACTION: ${action}
|
|
1508
|
+
RIGHT_GIT_STAGE_ROOT: \${{ runner.temp }}/right-git-stage-summary
|
|
1509
|
+
RIGHT_GIT_STAGE_EVIDENCE_ROOT: ${root}
|
|
1510
|
+
RIGHT_GIT_STAGE: dev-qualification
|
|
1511
|
+
RIGHT_GIT_STAGE_PRODUCER: dev-qualification-\${{ matrix.platform }}-\${{ matrix.architecture }}${extra}
|
|
1512
|
+
RIGHT_GIT_RELEASE_VERSION: \${{ needs.admission.outputs.version }}
|
|
1513
|
+
RIGHT_GIT_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}
|
|
1514
|
+
RIGHT_GIT_RELEASE_PLATFORM: \${{ matrix.platform }}
|
|
1515
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: \${{ matrix.architecture }}
|
|
1516
|
+
RIGHT_GIT_RUN_ID: \${{ github.run_id }}
|
|
1517
|
+
RIGHT_GIT_RUN_ATTEMPT: \${{ github.run_attempt }}`;
|
|
1518
|
+
const stepEnv = ` RIGHT_GIT_ARTIFACT_ROOT: ${root}
|
|
1519
|
+
RIGHT_GIT_RELEASE_PLATFORM: \${{ matrix.platform }}
|
|
1520
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: \${{ matrix.architecture }}
|
|
1521
|
+
RIGHT_GIT_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}`;
|
|
1522
|
+
return `
|
|
1523
|
+
dev-qualification:
|
|
1524
|
+
needs: [admission]
|
|
1525
|
+
env:
|
|
1526
|
+
SCCACHE_GHA_ENABLED: "true"
|
|
1527
|
+
RUSTC_WRAPPER: "sccache"
|
|
1528
|
+
RIGHTKIT_DEV_SIGNING: "ci-adhoc"
|
|
1529
|
+
strategy:
|
|
1530
|
+
fail-fast: false
|
|
1531
|
+
matrix:
|
|
1532
|
+
${candidateMatrix(manifest)}
|
|
1533
|
+
runs-on: \${{ matrix.os }}
|
|
1534
|
+
steps:
|
|
1535
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
1536
|
+
with:
|
|
1537
|
+
ref: \${{ needs.admission.outputs.source_revision }}
|
|
1538
|
+
fetch-depth: 0
|
|
1539
|
+
persist-credentials: false
|
|
1540
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
1541
|
+
with:
|
|
1542
|
+
node-version: \${{ matrix.node }}
|
|
1543
|
+
package-manager-cache: false
|
|
1544
|
+
${pm.setup}
|
|
1545
|
+
- uses: dtolnay/rust-toolchain@f8be11a05b1d4f3fcebe6410cc16743212b999b0
|
|
1546
|
+
with:
|
|
1547
|
+
components: rustfmt, clippy
|
|
1548
|
+
targets: \${{ matrix.targetTriple }}
|
|
1549
|
+
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
1550
|
+
with:
|
|
1551
|
+
workspaces: |
|
|
1552
|
+
${(manifest.rustCache?.workspaces ?? ["engine"]).map((workspace) => ` ${workspace} -> target`).join("\n")}
|
|
1553
|
+
shared-key: ${artifactPrefix}-rust
|
|
1554
|
+
add-job-id-key: false
|
|
1555
|
+
${cacheKeyLine ? `${cacheKeyLine}\n` : ""} cache-workspace-crates: false
|
|
1556
|
+
cache-on-failure: true
|
|
1557
|
+
save-if: true
|
|
1558
|
+
- uses: Mozilla-Actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
|
|
1559
|
+
with:
|
|
1560
|
+
version: "v0.16.0"
|
|
1561
|
+
- run: ${pm.installCommand}
|
|
1562
|
+
- name: Initialize dev-qualification stage summary
|
|
1563
|
+
run: ${pm.runPrefix} ${manifest.candidate.stageSummaryScript}
|
|
1564
|
+
env:
|
|
1565
|
+
${stageEnv("init")}${swiftPrivatePackagesConfigureStep(manifest)}
|
|
1566
|
+
- name: Build dev build (QA surface on, never signed)
|
|
1567
|
+
run: ${pm.runPrefix} ${dev.buildScript}
|
|
1568
|
+
env:
|
|
1569
|
+
${stepEnv}
|
|
1570
|
+
- name: Run in-app journeys against the dev build
|
|
1571
|
+
run: ${pm.runPrefix} ${dev.journeyScript}
|
|
1572
|
+
env:
|
|
1573
|
+
${stepEnv}${swiftPrivatePackagesCleanupStep(manifest)}
|
|
1574
|
+
- name: Finalize dev-qualification stage summary
|
|
1575
|
+
if: \${{ always() }}
|
|
1576
|
+
run: ${pm.runPrefix} ${manifest.candidate.stageSummaryScript}
|
|
1577
|
+
env:
|
|
1578
|
+
${stageEnv("finalize", `
|
|
1579
|
+
RIGHT_GIT_STAGE_STATUS: \${{ job.status == 'success' && 'SUCCEEDED' || 'FAILED' }}
|
|
1580
|
+
RIGHT_GIT_STAGE_EXIT_CODE: \${{ job.status == 'success' && '0' || '1' }}`)}
|
|
1581
|
+
- name: Upload dev-qualification evidence
|
|
1582
|
+
if: \${{ always() }}
|
|
1583
|
+
uses: actions/upload-artifact@${UPLOAD_ARTIFACT_SHA} # v4
|
|
1584
|
+
with:
|
|
1585
|
+
name: ${artifactPrefix}-\${{ github.run_id }}-\${{ github.run_attempt }}-devqual-\${{ matrix.platform }}-\${{ matrix.architecture }}-${identity}
|
|
1586
|
+
path: ${root}/**
|
|
1587
|
+
if-no-files-found: error
|
|
1588
|
+
- name: Upload dev-qualification stage summary
|
|
1589
|
+
if: \${{ always() }}
|
|
1590
|
+
uses: actions/upload-artifact@${UPLOAD_ARTIFACT_SHA} # v4
|
|
1591
|
+
with:
|
|
1592
|
+
name: ${artifactPrefix}-\${{ github.run_id }}-\${{ github.run_attempt }}-summary-dev-qualification-\${{ matrix.platform }}-\${{ matrix.architecture }}-${identity}
|
|
1593
|
+
path: \${{ runner.temp }}/right-git-stage-summary/stage-summary.json
|
|
1594
|
+
if-no-files-found: error
|
|
1595
|
+
`;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1119
1598
|
function windowsSigningJob(manifest, pm, artifactPrefix) {
|
|
1120
1599
|
if (manifest.candidate?.signWindows !== true) return "";
|
|
1121
1600
|
const nodeVersion = String(manifest.matrix.node[0]);
|
|
@@ -1130,12 +1609,15 @@ function windowsSigningJob(manifest, pm, artifactPrefix) {
|
|
|
1130
1609
|
: ` LEGION_UNSIGNED_CANDIDATE_ROOT: \${{ runner.temp }}/unsigned-windows-candidate
|
|
1131
1610
|
RIGHT_GIT_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}
|
|
1132
1611
|
LEGION_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}`;
|
|
1612
|
+
// Orthic-Labs/rightkit#183: a source QA receipt carried in the candidate handoff (`qa/source.receipt.json`, written by
|
|
1613
|
+
// `right-release qa --stage source --carry-to <artifact root>/qa`) is read by `right-release build`. Absent file: no effect.
|
|
1614
|
+
const qaReceiptEnvironment = `\n RIGHT_RELEASE_QA_RECEIPT: \${{ runner.temp }}/unsigned-windows-candidate/qa`;
|
|
1133
1615
|
const uploadPath = releaseChain
|
|
1134
1616
|
? " ${{ runner.temp }}/finalized-windows/**"
|
|
1135
1617
|
: " dist/releases/windows/**\n .right-release/receipts/windows-*.json";
|
|
1136
1618
|
return `
|
|
1137
1619
|
windows-sign:
|
|
1138
|
-
needs:
|
|
1620
|
+
needs: ${signingNeeds(manifest)}
|
|
1139
1621
|
if: \${{ needs.admission.outputs.signed_qualification == 'true' }}
|
|
1140
1622
|
environment: ${releaseEnvironment(manifest, "signing")}
|
|
1141
1623
|
strategy:
|
|
@@ -1205,7 +1687,7 @@ ${pm.setup}
|
|
|
1205
1687
|
- name: Sign & finalize Windows candidate
|
|
1206
1688
|
run: ${finalizeCommand}
|
|
1207
1689
|
env:
|
|
1208
|
-
${finalizeEnvironment}
|
|
1690
|
+
${finalizeEnvironment}${qaReceiptEnvironment}
|
|
1209
1691
|
RIGHT_GIT_RELEASE_PLATFORM: \${{ matrix.platform }}
|
|
1210
1692
|
RIGHT_GIT_RELEASE_ARCHITECTURE: \${{ matrix.architecture }}
|
|
1211
1693
|
AZURE_ARTIFACT_SIGNING_ENDPOINT: \${{ vars.AZURE_ARTIFACT_SIGNING_ENDPOINT }}
|
|
@@ -1260,12 +1742,13 @@ function macosSigningJob(manifest, pm, artifactPrefix) {
|
|
|
1260
1742
|
: ` LEGION_UNSIGNED_CANDIDATE_ROOT: \${{ runner.temp }}/unsigned-macos-candidate
|
|
1261
1743
|
RIGHT_GIT_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}
|
|
1262
1744
|
LEGION_SOURCE_REVISION: \${{ needs.admission.outputs.source_revision }}`;
|
|
1745
|
+
const qaReceiptEnvironment = `\n RIGHT_RELEASE_QA_RECEIPT: \${{ runner.temp }}/unsigned-macos-candidate/qa`;
|
|
1263
1746
|
const uploadPath = releaseChain
|
|
1264
1747
|
? " ${{ runner.temp }}/finalized-macos/**"
|
|
1265
1748
|
: " dist/releases/mac/**\n .right-release/receipts/macos-*.json";
|
|
1266
1749
|
return `
|
|
1267
1750
|
macos-sign:
|
|
1268
|
-
needs:
|
|
1751
|
+
needs: ${signingNeeds(manifest)}
|
|
1269
1752
|
if: \${{ needs.admission.outputs.signed_qualification == 'true' }}
|
|
1270
1753
|
environment: ${releaseEnvironment(manifest, "signing")}
|
|
1271
1754
|
strategy:
|
|
@@ -1333,7 +1816,7 @@ ${pm.setup}
|
|
|
1333
1816
|
- name: Sign, notarize & finalize macOS candidate
|
|
1334
1817
|
run: ${finalizeCommand}
|
|
1335
1818
|
env:
|
|
1336
|
-
${finalizeEnvironment}
|
|
1819
|
+
${finalizeEnvironment}${qaReceiptEnvironment}
|
|
1337
1820
|
RIGHT_GIT_RELEASE_PLATFORM: \${{ matrix.platform }}
|
|
1338
1821
|
RIGHT_GIT_RELEASE_ARCHITECTURE: \${{ matrix.architecture }}
|
|
1339
1822
|
APPLE_DEVELOPER_ID: \${{ vars.APPLE_DEVELOPER_ID }}
|
|
@@ -1629,7 +2112,13 @@ export function ownershipStep(manifest, lane = "ci") {
|
|
|
1629
2112
|
: manifest.profile === "rust-hybrid"
|
|
1630
2113
|
? "\${{ inputs.source_revision }}"
|
|
1631
2114
|
: "\${{ inputs.source_revision || github.sha }}";
|
|
1632
|
-
|
|
2115
|
+
// Ownership approval supports only macOS and Windows (Orthic-Labs/rightkit#245). A rust-hybrid ci
|
|
2116
|
+
// job that runs every matrix.os runner (ciAllOs) and declares a Linux runner skips the step there.
|
|
2117
|
+
// Manifests with no Linux runner in that matrix render the step unchanged.
|
|
2118
|
+
const skipOnLinux = lane === "ci" && manifest.profile === "rust-hybrid" && manifest.ciAllOs === true
|
|
2119
|
+
&& manifest.matrix.os.some((runner) => /^(ubuntu|linux)/i.test(runner));
|
|
2120
|
+
const linuxGuard = skipOnLinux ? " if: ${{ runner.os != 'Linux' }}\n" : "";
|
|
2121
|
+
return `\n - name: RightKit ownership (protected registry roots)\n${linuxGuard} shell: bash\n run: test "$(git rev-parse HEAD)" = "${sourceRevision}" && ${ownershipCommand}`;
|
|
1633
2122
|
}
|
|
1634
2123
|
|
|
1635
2124
|
/**
|
|
@@ -1784,6 +2273,7 @@ export function buildRenderContext(manifest, repoPath, lane = "ci") {
|
|
|
1784
2273
|
TEMPLATE_VERSION: manifest.templateVersion,
|
|
1785
2274
|
RUST_CACHE_WORKSPACES: rustWorkspaces.map((workspace) => ` ${workspace} -> target`).join("\n"),
|
|
1786
2275
|
RUST_REQUIRED_FOR_GATE: manifest.rustCache?.requiredForGate === true ? "true" : "false",
|
|
2276
|
+
DEV_QUALIFICATION_JOB: devQualificationJob(manifest, pm, artifactPrefix, cacheKeyLine),
|
|
1787
2277
|
WINDOWS_SIGNING_JOB: windowsSigningJob(manifest, pm, artifactPrefix),
|
|
1788
2278
|
MACOS_SIGNING_JOB: macosSigningJob(manifest, pm, artifactPrefix),
|
|
1789
2279
|
RELEASE_CHAIN_JOBS: releaseChainJobs(manifest, pm, artifactPrefix),
|
|
@@ -1798,7 +2288,17 @@ export function buildRenderContext(manifest, repoPath, lane = "ci") {
|
|
|
1798
2288
|
// sccache refuses CARGO_INCREMENTAL=1; incremental CI relies on the rust-cache target dir instead.
|
|
1799
2289
|
CI_RUSTC_WRAPPER: manifest.ciIncremental === true ? '""' : "${{ steps.rust-changes.outputs.required == 'true' && 'sccache' || '' }}",
|
|
1800
2290
|
CI_DERIVED_DATA_STEP: derivedDataStep(manifest),
|
|
1801
|
-
|
|
2291
|
+
// Default-branch pushes are never cancelled by the workflow-level group: the `supersede` job decides
|
|
2292
|
+
// (queue mode: nobody cancels them). PR and dispatch runs keep cancelling superseded runs.
|
|
2293
|
+
CI_CANCEL_IN_PROGRESS: CI_CANCEL_MAIN_QUEUE_EXPRESSION,
|
|
2294
|
+
// swift-check has no supersede job: it keeps cancelling superseded runs unless queue mode is set.
|
|
2295
|
+
CI_SWIFT_CANCEL_IN_PROGRESS: manifest.concurrency?.mainPushes === "queue" ? CI_CANCEL_MAIN_QUEUE_EXPRESSION : "true",
|
|
2296
|
+
CI_CONCURRENCY_COMMENT: manifest.concurrency?.mainPushes === "queue"
|
|
2297
|
+
? `# concurrency.mainPushes queue, recorded exception to one CI run per repo: ${manifest.concurrency.reason.trim()}\n`
|
|
2298
|
+
: "",
|
|
2299
|
+
CI_CONCURRENCY_GROUP: manifest.concurrency?.mainPushes === "queue" ? CI_GROUP_PER_REF : CI_GROUP_SUPERSEDE,
|
|
2300
|
+
CI_SUPERSEDE_JOB: manifest.concurrency?.mainPushes === "queue" ? "" : supersedeJob(manifest),
|
|
2301
|
+
CI_JOB_CONCURRENCY: manifest.concurrency?.mainPushes === "queue" ? "" : ciJobConcurrency(),
|
|
1802
2302
|
RUST_CACHE_KEY: cacheKeyLine ? `${cacheKeyLine}\n` : "",
|
|
1803
2303
|
};
|
|
1804
2304
|
|
|
@@ -1810,12 +2310,27 @@ export function buildRenderContext(manifest, repoPath, lane = "ci") {
|
|
|
1810
2310
|
// simply ABSENT from the context rather than present-with-undefined, so
|
|
1811
2311
|
// render.mjs's own `Object.hasOwn` check does the right thing if a
|
|
1812
2312
|
// template ever references a token this manifest didn't opt into.
|
|
2313
|
+
if (manifest.swift?.check) {
|
|
2314
|
+
const check = manifest.swift.check;
|
|
2315
|
+
Object.assign(context, {
|
|
2316
|
+
SWIFT_CHECK_RUNNER: check.runner,
|
|
2317
|
+
SWIFT_CHECK_XCODE_VERSION: check.xcodeVersion,
|
|
2318
|
+
SWIFT_CHECK_DIRECTORY: check.projectDirectory,
|
|
2319
|
+
SWIFT_CHECK_SPEC: check.spec,
|
|
2320
|
+
SWIFT_CHECK_PROJECT: check.project,
|
|
2321
|
+
SWIFT_CHECK_SCHEME: check.scheme,
|
|
2322
|
+
SWIFT_CHECK_XCODEGEN_VERSION: check.xcodegenVersion,
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
1813
2325
|
if (manifest.gate) {
|
|
1814
2326
|
context.GATE_PATH = manifest.gate.path;
|
|
1815
2327
|
}
|
|
1816
2328
|
if (manifest.regenerate) {
|
|
1817
2329
|
context.REGENERATE_SCRIPT = manifest.regenerate.script;
|
|
1818
2330
|
}
|
|
2331
|
+
if (manifest.signExisting && lane === "sign-existing") {
|
|
2332
|
+
context.SIGN_EXISTING_JOB = signExistingJob(manifest);
|
|
2333
|
+
}
|
|
1819
2334
|
if (manifest.candidate) {
|
|
1820
2335
|
context.CANDIDATE_BUILD_SCRIPT = manifest.candidate.buildScript;
|
|
1821
2336
|
context.CANDIDATE_CHECK_SCRIPT = manifest.candidate.checkScript;
|