@cbnventures/nova 0.38.0 → 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/build/package.json +1 -1
- package/build/scaffold-versions.json +10 -9
- package/build/src/api/app-store-connect.d.ts +17 -2
- package/build/src/api/app-store-connect.d.ts.map +1 -1
- package/build/src/api/app-store-connect.js +654 -171
- package/build/src/api/app-store-connect.js.map +1 -1
- package/build/src/api/docker-hub.d.ts +14 -0
- package/build/src/api/docker-hub.d.ts.map +1 -0
- package/build/src/api/docker-hub.js +275 -0
- package/build/src/api/docker-hub.js.map +1 -0
- package/build/src/api/github-runner-images.d.ts +13 -0
- package/build/src/api/github-runner-images.d.ts.map +1 -0
- package/build/src/api/github-runner-images.js +238 -0
- package/build/src/api/github-runner-images.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-validate.js +260 -50
- package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -4
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.js +632 -74
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
- package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/agent-conventions.js +1 -0
- package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
- package/build/src/cli/index.js +41 -1
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/integration/app-store-connect.d.ts +10 -0
- package/build/src/cli/integration/app-store-connect.d.ts.map +1 -1
- package/build/src/cli/integration/app-store-connect.js +701 -80
- package/build/src/cli/integration/app-store-connect.js.map +1 -1
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts +3 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js +72 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.d.ts +5 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.js +124 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.js.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.d.ts +5 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.js +63 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.js.map +1 -0
- package/build/src/cli/recipe/index.d.ts.map +1 -1
- package/build/src/cli/recipe/index.js +12 -0
- package/build/src/cli/recipe/index.js.map +1 -1
- package/build/src/cli/recipe/nova-config/normalize-order.js +3 -3
- package/build/src/cli/recipe/nova-config/normalize-order.js.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.d.ts +3 -0
- package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.js +140 -6
- package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
- package/build/src/cli/scaffold/tool/serverless.d.ts +2 -0
- package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
- package/build/src/cli/scaffold/tool/serverless.js +35 -1
- package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts +7 -0
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +800 -7
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/configure.d.ts +4 -1
- package/build/src/cli/utility/configure.d.ts.map +1 -1
- package/build/src/cli/utility/configure.js +396 -24
- package/build/src/cli/utility/configure.js.map +1 -1
- package/build/src/lib/docker-packaging.d.ts +1 -0
- package/build/src/lib/docker-packaging.d.ts.map +1 -1
- package/build/src/lib/docker-packaging.js +39 -2
- package/build/src/lib/docker-packaging.js.map +1 -1
- package/build/src/lib/env-namespace.d.ts.map +1 -1
- package/build/src/lib/env-namespace.js +2 -1
- package/build/src/lib/env-namespace.js.map +1 -1
- package/build/src/lib/item.d.ts +2 -1
- package/build/src/lib/item.d.ts.map +1 -1
- package/build/src/lib/item.js +23 -0
- package/build/src/lib/item.js.map +1 -1
- package/build/src/lib/nova-config-order.d.ts.map +1 -1
- package/build/src/lib/nova-config-order.js +35 -1
- package/build/src/lib/nova-config-order.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +1 -0
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +178 -3
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/regex.d.ts +16 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +16 -0
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/scaffold.d.ts +3 -3
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +111 -8
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/schema.d.ts +34 -0
- package/build/src/lib/schema.d.ts.map +1 -1
- package/build/src/lib/schema.js +31 -0
- package/build/src/lib/schema.js.map +1 -1
- package/build/src/lib/workflow-templates.d.ts +4 -1
- package/build/src/lib/workflow-templates.d.ts.map +1 -1
- package/build/src/lib/workflow-templates.js +46 -16
- package/build/src/lib/workflow-templates.js.map +1 -1
- package/build/src/types/api/app-store-connect.d.ts +476 -33
- package/build/src/types/api/docker-hub.d.ts +237 -0
- package/build/src/types/api/github-runner-images.d.ts +199 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +79 -17
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +131 -9
- package/build/src/types/cli/index.d.ts +2 -0
- package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
- package/build/src/types/cli/recipe/docker-hub/docker-hub-precheck.d.ts +78 -0
- package/build/src/types/cli/recipe/docker-hub/sync-identity.d.ts +80 -0
- package/build/src/types/cli/recipe/docker-hub/sync-policies.d.ts +57 -0
- package/build/src/types/cli/recipe/index.d.ts +3 -1
- package/build/src/types/cli/scaffold/package/pfsense.d.ts +83 -0
- package/build/src/types/cli/scaffold/tool/serverless.d.ts +30 -0
- package/build/src/types/cli/utility/changelog.d.ts +327 -1
- package/build/src/types/cli/utility/configure.d.ts +199 -4
- package/build/src/types/lib/docker-packaging.d.ts +25 -1
- package/build/src/types/lib/env-namespace.d.ts +4 -1
- package/build/src/types/lib/item.d.ts +11 -0
- package/build/src/types/lib/nova-config-order.d.ts +34 -1
- package/build/src/types/lib/nova-config.d.ts +100 -0
- package/build/src/types/lib/regex.d.ts +91 -0
- package/build/src/types/lib/scaffold.d.ts +48 -4
- package/build/src/types/lib/workflow-templates.d.ts +26 -0
- package/build/src/types/shared.d.ts +353 -3
- package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -0
- package/build/src/types/tests/api/docker-hub.test.d.ts +84 -0
- package/build/src/types/tests/api/github-runner-images.test.d.ts +113 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +19 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +0 -9
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +108 -25
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +139 -30
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +45 -0
- package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +2 -2
- package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +2 -0
- package/build/src/types/tests/cli/integration/app-store-connect.test.d.ts +876 -0
- package/build/src/types/tests/cli/recipe/nova-config/normalize-order.test.d.ts +4 -0
- package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +21 -0
- package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +14 -0
- package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +21 -0
- package/build/src/types/tests/cli/utility/changelog-fold.test.d.ts +350 -0
- package/build/src/types/tests/cli/utility/changelog.test.d.ts +50 -0
- package/build/src/types/tests/cli/utility/configure.test.d.ts +90 -0
- package/build/src/types/tests/lib/nova-config.test.d.ts +29 -1
- package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +136 -0
- package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -0
- package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/nova.md +6 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/pfsense.md +311 -0
- package/build/templates/scaffold/app/android/package.json +1 -1
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
- package/build/templates/scaffold/app/apple/package.json +1 -1
- package/build/templates/scaffold/app/astro/package.json +1 -1
- package/build/templates/scaffold/app/discord-bot/package.json +1 -1
- package/build/templates/scaffold/app/express/package.json +1 -1
- package/build/templates/scaffold/app/nextjs/package.json +1 -1
- package/build/templates/scaffold/app/vite/package.json +1 -1
- package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
- package/build/templates/scaffold/package/github-action/package.json +1 -1
- package/build/templates/scaffold/package/homebridge/package.json +1 -1
- package/build/templates/scaffold/package/pfsense/package.json +2 -2
- package/build/templates/scaffold/package/pfsense/port/Makefile.template +16 -1
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php +93 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php +40 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php +1667 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +161 -13
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +37 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +203 -8
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg +12 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub +9 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php +437 -0
- package/build/templates/scaffold/package/pfsense/port/pkg-plist +6 -0
- package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +61 -0
- package/build/templates/scaffold/package/pfsense/scripts/check-package.mjs +114 -1
- package/build/templates/scaffold/package/pfsense/scripts/regex.mjs +10 -0
- package/build/templates/scaffold/package/pfsense/scripts/stage-package.mjs +48 -2
- package/build/templates/scaffold/package/pfsense/tests/updates.php +695 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +1 -1
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/docker-image/common/Dockerfile +7 -0
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +40 -2
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/landing-page.d.ts +23 -0
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +119 -4
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +25 -3
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/landing-page.ts +278 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +121 -6
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +49 -12
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +3 -1
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/function/landing-page.ts +278 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +17 -2
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +40 -2
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/function/landing-page.d.ts +23 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json +3 -1
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +7 -1
- package/package.json +1 -1
- package/build/templates/scaffold/package/pfsense-root/.github/workflows/pfsense-[__WORKSPACE_NAME__].yml +0 -62
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { basename, join, } from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import { GITHUB_RUNNER_IMAGES_README_URL, Runner as GithubRunnerImages, } from '../../../api/github-runner-images.js';
|
|
4
5
|
import { Runner as LibCorepack } from '../../../lib/corepack.js';
|
|
5
6
|
import { libEnvNamespace } from '../../../lib/env-namespace.js';
|
|
6
7
|
import { Runner as LibNovaConfig } from '../../../lib/nova-config.js';
|
|
7
|
-
import { LIB_REGEX_CHARACTER_BACKSLASH, LIB_REGEX_CHARACTER_BACKTICK, LIB_REGEX_CHARACTER_DOLLAR, LIB_REGEX_CHARACTER_DOUBLE_QUOTE, LIB_REGEX_CHARACTER_FORWARD_SLASH, LIB_REGEX_PATTERN_DOUBLE_QUOTE, LIB_REGEX_PATTERN_LEADING_DOT_SLASH, } from '../../../lib/regex.js';
|
|
8
|
+
import { LIB_REGEX_CHARACTER_BACKSLASH, LIB_REGEX_CHARACTER_BACKTICK, LIB_REGEX_CHARACTER_DOLLAR, LIB_REGEX_CHARACTER_DOUBLE_QUOTE, LIB_REGEX_CHARACTER_FORWARD_SLASH, LIB_REGEX_PATTERN_DOUBLE_QUOTE, LIB_REGEX_PATTERN_LEADING_DOT_SLASH, LIB_REGEX_PATTERN_NON_ALPHANUMERIC_RUN, } from '../../../lib/regex.js';
|
|
8
9
|
import { getScaffoldVersion } from '../../../lib/scaffold-versions.js';
|
|
9
10
|
import { isProjectRoot, pathExists, renameFileWithDate, saveGeneratedFile, shellQuote, } from '../../../lib/utility.js';
|
|
11
|
+
import { libWorkflowContainerPlatformArchitectures, libWorkflowStepTimeoutDefaults, } from '../../../lib/workflow-templates.js';
|
|
10
12
|
import { Logger } from '../../../toolkit/index.js';
|
|
11
13
|
import { Runner as Validator } from './workflows-blueprint-validate.js';
|
|
12
14
|
import { Runner as Variables } from './workflows-blueprint-variables.js';
|
|
@@ -36,6 +38,7 @@ export class Runner {
|
|
|
36
38
|
const config = await new LibNovaConfig().load();
|
|
37
39
|
const workspaces = config['workspaces'] ?? {};
|
|
38
40
|
const artifacts = config['artifacts'] ?? {};
|
|
41
|
+
const dockerHub = config['dockerHub'];
|
|
39
42
|
const environment = config['environment'] ?? {};
|
|
40
43
|
const configPath = join(currentDirectory, 'nova.config.json');
|
|
41
44
|
let rawConfig = {};
|
|
@@ -59,16 +62,34 @@ export class Runner {
|
|
|
59
62
|
}).info('No workflows configured.');
|
|
60
63
|
return 'completed';
|
|
61
64
|
}
|
|
62
|
-
const
|
|
65
|
+
const runnerImages = await GithubRunnerImages.fetchRunnerImages();
|
|
66
|
+
if (runnerImages === undefined) {
|
|
67
|
+
Logger.customize({
|
|
68
|
+
name: 'Runner.generate',
|
|
69
|
+
purpose: 'runners',
|
|
70
|
+
}).error(`Could not read GitHub's runner list from ${GITHUB_RUNNER_IMAGES_README_URL}.`);
|
|
71
|
+
process.exitCode = 1;
|
|
72
|
+
return 'cancelled';
|
|
73
|
+
}
|
|
74
|
+
const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy'], environment, artifacts, dockerHub, runnerImages);
|
|
63
75
|
const validatedWorkflows = validation['workflows'];
|
|
76
|
+
const hasValidationErrors = validation['diagnostics'].some((diagnostic) => diagnostic['severity'] === 'error');
|
|
64
77
|
for (const diagnosticEntry of validation['diagnostics']) {
|
|
65
78
|
const diagnostic = diagnosticEntry;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
if (diagnostic['severity'] === 'warning') {
|
|
80
|
+
Logger.customize({
|
|
81
|
+
name: 'Runner.generate',
|
|
82
|
+
purpose: 'validate',
|
|
83
|
+
}).warn(diagnostic['message']);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
Logger.customize({
|
|
87
|
+
name: 'Runner.generate',
|
|
88
|
+
purpose: 'validate',
|
|
89
|
+
}).error(diagnostic['message']);
|
|
90
|
+
}
|
|
70
91
|
}
|
|
71
|
-
if (
|
|
92
|
+
if (hasValidationErrors === true) {
|
|
72
93
|
process.exitCode = 1;
|
|
73
94
|
}
|
|
74
95
|
const hasPublishWorkflow = validatedWorkflows.some((workflow) => workflow['template'] === 'publish');
|
|
@@ -107,7 +128,7 @@ export class Runner {
|
|
|
107
128
|
const template = entry['template'];
|
|
108
129
|
const suffix = entry['name'];
|
|
109
130
|
const outputFileName = (suffix !== undefined) ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
|
|
110
|
-
const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts);
|
|
131
|
+
const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts, dockerHub);
|
|
111
132
|
const entrySetupLines = Variables.collectSetupLines(entry, outputFileName, environment);
|
|
112
133
|
generatedSet.add(outputFileName);
|
|
113
134
|
setupLines.push(...entrySetupLines);
|
|
@@ -122,7 +143,7 @@ export class Runner {
|
|
|
122
143
|
await saveGeneratedFile(targetPath, serialized, isReplaceFile);
|
|
123
144
|
}
|
|
124
145
|
if (isDryRun !== true
|
|
125
|
-
&&
|
|
146
|
+
&& hasValidationErrors === false
|
|
126
147
|
&& await pathExists(workflowsDirectory) === true) {
|
|
127
148
|
let existingEntries = [];
|
|
128
149
|
try {
|
|
@@ -172,7 +193,7 @@ export class Runner {
|
|
|
172
193
|
}
|
|
173
194
|
return 'completed';
|
|
174
195
|
}
|
|
175
|
-
static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
|
|
196
|
+
static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, dockerHub = undefined) {
|
|
176
197
|
const template = entry['template'];
|
|
177
198
|
let workflow = undefined;
|
|
178
199
|
if (template === 'check-sponsor-gated-issues') {
|
|
@@ -182,17 +203,21 @@ export class Runner {
|
|
|
182
203
|
workflow = Runner.buildLockInactiveIssues(entry, environment);
|
|
183
204
|
}
|
|
184
205
|
else {
|
|
185
|
-
workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts);
|
|
206
|
+
workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts, dockerHub);
|
|
186
207
|
}
|
|
187
208
|
const runsOn = entry['runsOn'];
|
|
188
|
-
const timeoutMinutes = entry['timeoutMinutes'];
|
|
189
209
|
for (const jobEntry of workflow['jobs']) {
|
|
190
210
|
const job = jobEntry;
|
|
191
211
|
if (runsOn !== undefined) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
212
|
+
const runnerArchitecture = job['runnerArchitecture'];
|
|
213
|
+
let jobRunsOn = runsOn;
|
|
214
|
+
if (runnerArchitecture === 'arm64' && runsOn.endsWith('-arm') === false) {
|
|
215
|
+
jobRunsOn = `${runsOn}-arm`;
|
|
216
|
+
}
|
|
217
|
+
else if (runnerArchitecture === 'x64' && runsOn.endsWith('-arm') === true) {
|
|
218
|
+
jobRunsOn = runsOn.slice(0, -4);
|
|
219
|
+
}
|
|
220
|
+
Reflect.set(job, 'runsOn', jobRunsOn);
|
|
196
221
|
}
|
|
197
222
|
}
|
|
198
223
|
return Runner.serialize(workflow);
|
|
@@ -216,7 +241,7 @@ export class Runner {
|
|
|
216
241
|
lines.push('');
|
|
217
242
|
lines.push(...Runner.serializeEnv(workflow['env']));
|
|
218
243
|
lines.push('');
|
|
219
|
-
lines.push(...Runner.serializeJobs(workflow['jobs']));
|
|
244
|
+
lines.push(...Runner.serializeJobs(workflow['jobs'], workflow['stepTimeoutMinutes']));
|
|
220
245
|
return `${lines.join('\n')}\n`;
|
|
221
246
|
}
|
|
222
247
|
static buildCheckSponsorGatedIssues(entry, environment = {}) {
|
|
@@ -277,6 +302,7 @@ export class Runner {
|
|
|
277
302
|
];
|
|
278
303
|
const step = {
|
|
279
304
|
name: 'Check support issues',
|
|
305
|
+
kind: 'deploy',
|
|
280
306
|
uses: getScaffoldVersion('workflowActionSponsorGatedSupport'),
|
|
281
307
|
env: [
|
|
282
308
|
{
|
|
@@ -338,7 +364,7 @@ export class Runner {
|
|
|
338
364
|
const job = {
|
|
339
365
|
id: 'check-issues',
|
|
340
366
|
runsOn: 'ubuntu-latest',
|
|
341
|
-
timeoutMinutes: 5,
|
|
367
|
+
timeoutMinutes: entry['timeoutMinutes'] ?? 5,
|
|
342
368
|
permissions: {
|
|
343
369
|
contents: 'read',
|
|
344
370
|
issues: 'write',
|
|
@@ -346,6 +372,7 @@ export class Runner {
|
|
|
346
372
|
steps: [
|
|
347
373
|
{
|
|
348
374
|
name: 'Checkout repository',
|
|
375
|
+
kind: 'checkout',
|
|
349
376
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
350
377
|
},
|
|
351
378
|
step,
|
|
@@ -363,6 +390,7 @@ export class Runner {
|
|
|
363
390
|
cancelInProgress: false,
|
|
364
391
|
},
|
|
365
392
|
env,
|
|
393
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
366
394
|
jobs: [job],
|
|
367
395
|
};
|
|
368
396
|
}
|
|
@@ -404,6 +432,7 @@ export class Runner {
|
|
|
404
432
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
405
433
|
const step = {
|
|
406
434
|
name: 'Lock inactive threads',
|
|
435
|
+
kind: 'deploy',
|
|
407
436
|
uses: getScaffoldVersion('workflowActionLockInactiveThreads'),
|
|
408
437
|
env: [{
|
|
409
438
|
key: 'GITHUB_TOKEN',
|
|
@@ -451,7 +480,7 @@ export class Runner {
|
|
|
451
480
|
const job = {
|
|
452
481
|
id: 'lock-inactive-issues',
|
|
453
482
|
runsOn: 'ubuntu-latest',
|
|
454
|
-
timeoutMinutes: 5,
|
|
483
|
+
timeoutMinutes: entry['timeoutMinutes'] ?? 5,
|
|
455
484
|
steps: [step],
|
|
456
485
|
};
|
|
457
486
|
return {
|
|
@@ -467,10 +496,11 @@ export class Runner {
|
|
|
467
496
|
cancelInProgress: false,
|
|
468
497
|
},
|
|
469
498
|
env,
|
|
499
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
470
500
|
jobs: [job],
|
|
471
501
|
};
|
|
472
502
|
}
|
|
473
|
-
static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
|
|
503
|
+
static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, dockerHub = undefined) {
|
|
474
504
|
const suffix = entry['name'];
|
|
475
505
|
const workflowId = Runner.resolveWorkflowId(suffix);
|
|
476
506
|
const on = [];
|
|
@@ -482,6 +512,7 @@ export class Runner {
|
|
|
482
512
|
const profileAware = environmentSelection !== undefined;
|
|
483
513
|
const selectedEnvironmentExpression = 'github.event_name == \'workflow_dispatch\' && (inputs.environment || \'staging\') || github.event_name == \'release\' && github.event.release.prerelease && \'staging\' || github.event_name == \'release\' && \'production\' || \'from tag\'';
|
|
484
514
|
const hasContainerTarget = targets.some((target) => target['to'] === 'docker-hub' || target['to'] === 'ghcr');
|
|
515
|
+
const hasPfsenseTarget = targets.some((target) => target['to'] === 'pfsense');
|
|
485
516
|
const containerPlatforms = entry['containerPlatforms'] ?? [
|
|
486
517
|
'linux/amd64',
|
|
487
518
|
'linux/arm64',
|
|
@@ -590,7 +621,16 @@ export class Runner {
|
|
|
590
621
|
type: 'boolean',
|
|
591
622
|
default: true,
|
|
592
623
|
}];
|
|
593
|
-
if (
|
|
624
|
+
if (hasPfsenseTarget === true) {
|
|
625
|
+
dispatchInputs.push({
|
|
626
|
+
name: 'tag',
|
|
627
|
+
description: (hasContainerTarget === true) ? 'Existing GitHub release tag and image tag used when manually publishing' : 'Existing GitHub release tag that receives the package',
|
|
628
|
+
required: true,
|
|
629
|
+
type: 'string',
|
|
630
|
+
default: '',
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
else if (hasContainerTarget === true) {
|
|
594
634
|
dispatchInputs.push({
|
|
595
635
|
name: 'tag',
|
|
596
636
|
description: 'Required image tag when manually publishing',
|
|
@@ -668,6 +708,7 @@ export class Runner {
|
|
|
668
708
|
const steps = [
|
|
669
709
|
{
|
|
670
710
|
name: 'Checkout repository',
|
|
711
|
+
kind: 'checkout',
|
|
671
712
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
672
713
|
with: [
|
|
673
714
|
{
|
|
@@ -682,6 +723,7 @@ export class Runner {
|
|
|
682
723
|
},
|
|
683
724
|
{
|
|
684
725
|
name: 'Setup Node.js',
|
|
726
|
+
kind: 'setup',
|
|
685
727
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
686
728
|
with: [
|
|
687
729
|
{
|
|
@@ -696,6 +738,7 @@ export class Runner {
|
|
|
696
738
|
},
|
|
697
739
|
{
|
|
698
740
|
name: 'Install packages',
|
|
741
|
+
kind: 'install',
|
|
699
742
|
run: Runner.installPackagesRun(packageManager),
|
|
700
743
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
701
744
|
},
|
|
@@ -715,6 +758,7 @@ export class Runner {
|
|
|
715
758
|
}
|
|
716
759
|
const writeEnvStep = {
|
|
717
760
|
name: `Write environment file (${Runner.slugifyWorkingDir(scope)})`,
|
|
761
|
+
kind: 'setup',
|
|
718
762
|
env: buildValues.map((buildValue) => ({
|
|
719
763
|
key: buildValue['key'],
|
|
720
764
|
value: Runner.resolveDeliveryValueExpr(buildValue),
|
|
@@ -727,6 +771,7 @@ export class Runner {
|
|
|
727
771
|
}
|
|
728
772
|
steps.push({
|
|
729
773
|
name: 'Check project',
|
|
774
|
+
kind: 'check',
|
|
730
775
|
run: checkCommand,
|
|
731
776
|
runBlock: true,
|
|
732
777
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
@@ -734,6 +779,7 @@ export class Runner {
|
|
|
734
779
|
if (names.length > 0) {
|
|
735
780
|
steps.push({
|
|
736
781
|
name: 'Build project',
|
|
782
|
+
kind: 'build',
|
|
737
783
|
run: buildCommand,
|
|
738
784
|
runBlock: true,
|
|
739
785
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
@@ -742,6 +788,7 @@ export class Runner {
|
|
|
742
788
|
if (hasContainerTarget === true) {
|
|
743
789
|
steps.push({
|
|
744
790
|
name: 'Validate manual container tag',
|
|
791
|
+
kind: 'check',
|
|
745
792
|
if: Runner.expr('github.event_name == \'workflow_dispatch\' && !inputs.dry-run'),
|
|
746
793
|
env: [{
|
|
747
794
|
key: 'MANUAL_TAG',
|
|
@@ -782,6 +829,7 @@ export class Runner {
|
|
|
782
829
|
const uploadArtifactName = (uploadConfiguredArtifactName === undefined) ? `build-${uploadTarget['to']}-${Runner.slugifyWorkingDir(uploadTarget['path'])}` : `artifact-${uploadConfiguredArtifactName}`;
|
|
783
830
|
const uploadStep = {
|
|
784
831
|
name: (uploadConfiguredArtifactName === undefined) ? `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})` : `Upload assembled artifact (${uploadConfiguredArtifactName})`,
|
|
832
|
+
kind: 'artifact',
|
|
785
833
|
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
786
834
|
with: [
|
|
787
835
|
{
|
|
@@ -820,25 +868,32 @@ export class Runner {
|
|
|
820
868
|
if (artifactPreflightPaths.length > 0) {
|
|
821
869
|
steps.push(Runner.buildArtifactPreflightStep('Validate build artifacts', artifactPreflightPaths, Runner.expr('github.workspace')), ...artifactUploadSteps);
|
|
822
870
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
steps.push(...containerArtifactSteps);
|
|
826
|
-
}
|
|
871
|
+
const configuredTimeoutMinutes = entry['timeoutMinutes'];
|
|
872
|
+
const configuredBuildTimeoutMinutes = entry['buildTimeoutMinutes'];
|
|
827
873
|
const buildJob = {
|
|
828
874
|
id: 'build',
|
|
829
875
|
runsOn: 'ubuntu-latest',
|
|
830
|
-
timeoutMinutes:
|
|
876
|
+
timeoutMinutes: configuredBuildTimeoutMinutes
|
|
877
|
+
?? configuredTimeoutMinutes
|
|
878
|
+
?? 15,
|
|
831
879
|
permissions: {
|
|
832
880
|
contents: 'read',
|
|
833
881
|
},
|
|
834
882
|
steps,
|
|
835
883
|
};
|
|
836
884
|
const jobs = [buildJob];
|
|
885
|
+
if (hasContainerTarget === true) {
|
|
886
|
+
const containerJobs = Runner.buildContainerJobs(containerPlatforms, buildJob['timeoutMinutes'], (hasWorkflowRunNode === true) ? Runner.expr('github.event.workflow_run.head_sha') : undefined);
|
|
887
|
+
jobs.push(...containerJobs);
|
|
888
|
+
}
|
|
837
889
|
for (const target of targets) {
|
|
838
890
|
const deployTarget = target;
|
|
839
891
|
const targetSettings = deployTarget['with'];
|
|
840
892
|
const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
|
|
841
893
|
const deployConfiguredArtifactName = deployTarget['artifact'];
|
|
894
|
+
const deployTimeoutMinutes = deployTarget['timeoutMinutes']
|
|
895
|
+
?? configuredTimeoutMinutes
|
|
896
|
+
?? 15;
|
|
842
897
|
let deployArtifactName = `artifact-${deployConfiguredArtifactName}`;
|
|
843
898
|
if (isContainerTarget === true) {
|
|
844
899
|
deployArtifactName = 'container-oci';
|
|
@@ -850,12 +905,13 @@ export class Runner {
|
|
|
850
905
|
workingDir: deployTarget['path'],
|
|
851
906
|
artifactName: deployArtifactName,
|
|
852
907
|
...((deployConfiguredArtifactName === undefined) ? {} : { artifactDirectory: `build/${deployConfiguredArtifactName}` }),
|
|
853
|
-
needs: (isContainerTarget === true) ? ['build'] : Runner.resolveDeployNeeds(deployTarget),
|
|
908
|
+
needs: (isContainerTarget === true) ? ['build-container'] : Runner.resolveDeployNeeds(deployTarget),
|
|
854
909
|
targetSettings,
|
|
855
910
|
workflowSettings,
|
|
856
911
|
workspace: workspaces[deployTarget['path']],
|
|
857
912
|
environment,
|
|
858
913
|
packageManager,
|
|
914
|
+
timeoutMinutes: deployTimeoutMinutes,
|
|
859
915
|
...((environmentSelection === undefined) ? {} : { environmentSelection }),
|
|
860
916
|
};
|
|
861
917
|
if (deployTarget['to'] === 'npm') {
|
|
@@ -870,8 +926,12 @@ export class Runner {
|
|
|
870
926
|
else if (deployTarget['to'] === 'cloudflare-workers') {
|
|
871
927
|
jobs.push(Runner.buildCloudflareWorkersTarget(context));
|
|
872
928
|
}
|
|
873
|
-
else if (deployTarget['to'] === 'docker-hub') {
|
|
874
|
-
|
|
929
|
+
else if (deployTarget['to'] === 'docker-hub' && dockerHub !== undefined) {
|
|
930
|
+
const dockerHubContext = {
|
|
931
|
+
...context,
|
|
932
|
+
dockerHub,
|
|
933
|
+
};
|
|
934
|
+
jobs.push(Runner.buildDockerHubTarget(dockerHubContext));
|
|
875
935
|
}
|
|
876
936
|
else if (deployTarget['to'] === 'ghcr') {
|
|
877
937
|
jobs.push(Runner.buildGhcrTarget(context));
|
|
@@ -882,16 +942,13 @@ export class Runner {
|
|
|
882
942
|
else if (deployTarget['to'] === 'github-action') {
|
|
883
943
|
jobs.push(Runner.buildGithubActionTarget(context));
|
|
884
944
|
}
|
|
945
|
+
else if (deployTarget['to'] === 'pfsense') {
|
|
946
|
+
jobs.push(Runner.buildPfsenseTarget(context));
|
|
947
|
+
}
|
|
885
948
|
else if (deployTarget['to'] === 'vercel-nextjs') {
|
|
886
949
|
jobs.push(Runner.buildVercelNextjsTarget(context));
|
|
887
950
|
}
|
|
888
951
|
}
|
|
889
|
-
const configuredTimeoutMinutes = entry['timeoutMinutes'];
|
|
890
|
-
if (configuredTimeoutMinutes !== undefined) {
|
|
891
|
-
for (const configuredJob of jobs) {
|
|
892
|
-
configuredJob.timeoutMinutes = configuredTimeoutMinutes;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
952
|
if (jobsCondition !== undefined) {
|
|
896
953
|
for (const gatedJob of jobs) {
|
|
897
954
|
Reflect.set(gatedJob, 'if', jobsCondition);
|
|
@@ -909,6 +966,7 @@ export class Runner {
|
|
|
909
966
|
cancelInProgress: false,
|
|
910
967
|
},
|
|
911
968
|
env,
|
|
969
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
912
970
|
jobs,
|
|
913
971
|
};
|
|
914
972
|
}
|
|
@@ -952,6 +1010,7 @@ export class Runner {
|
|
|
952
1010
|
];
|
|
953
1011
|
return {
|
|
954
1012
|
name: 'Select Cloudflare deployment environment',
|
|
1013
|
+
kind: 'setup',
|
|
955
1014
|
env: [
|
|
956
1015
|
{
|
|
957
1016
|
key: 'MANUAL_ENVIRONMENT',
|
|
@@ -1069,6 +1128,7 @@ export class Runner {
|
|
|
1069
1128
|
}
|
|
1070
1129
|
return {
|
|
1071
1130
|
name: 'Validate Cloudflare deployment environment',
|
|
1131
|
+
kind: 'check',
|
|
1072
1132
|
env,
|
|
1073
1133
|
run: lines.join('\n'),
|
|
1074
1134
|
runBlock: true,
|
|
@@ -1118,7 +1178,7 @@ export class Runner {
|
|
|
1118
1178
|
id: `publish-npm-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1119
1179
|
needs: context['needs'],
|
|
1120
1180
|
runsOn: 'ubuntu-latest',
|
|
1121
|
-
timeoutMinutes:
|
|
1181
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1122
1182
|
permissions: {
|
|
1123
1183
|
'contents': 'read',
|
|
1124
1184
|
'id-token': 'write',
|
|
@@ -1126,10 +1186,12 @@ export class Runner {
|
|
|
1126
1186
|
steps: [
|
|
1127
1187
|
{
|
|
1128
1188
|
name: 'Checkout repository',
|
|
1189
|
+
kind: 'checkout',
|
|
1129
1190
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1130
1191
|
},
|
|
1131
1192
|
{
|
|
1132
1193
|
name: 'Setup Node.js',
|
|
1194
|
+
kind: 'setup',
|
|
1133
1195
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1134
1196
|
with: [
|
|
1135
1197
|
{
|
|
@@ -1148,10 +1210,12 @@ export class Runner {
|
|
|
1148
1210
|
},
|
|
1149
1211
|
{
|
|
1150
1212
|
name: 'Remove deprecated .npmrc entries',
|
|
1213
|
+
kind: 'setup',
|
|
1151
1214
|
run: Runner.removeDeprecatedNpmrcRun(),
|
|
1152
1215
|
},
|
|
1153
1216
|
{
|
|
1154
1217
|
name: 'Download build artifacts',
|
|
1218
|
+
kind: 'artifact',
|
|
1155
1219
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1156
1220
|
with: [
|
|
1157
1221
|
{
|
|
@@ -1166,6 +1230,7 @@ export class Runner {
|
|
|
1166
1230
|
},
|
|
1167
1231
|
{
|
|
1168
1232
|
name: 'Configure authentication',
|
|
1233
|
+
kind: 'registry',
|
|
1169
1234
|
env: [{
|
|
1170
1235
|
key: 'NPM_TOKEN',
|
|
1171
1236
|
value: Runner.resolveScopedCredExpr(variables, 'NPM_TOKEN', targetSettings, workflowSettings, environment, appPath),
|
|
@@ -1174,12 +1239,290 @@ export class Runner {
|
|
|
1174
1239
|
},
|
|
1175
1240
|
{
|
|
1176
1241
|
name: 'Publish package to npm',
|
|
1242
|
+
kind: 'deploy',
|
|
1177
1243
|
run: Runner.npmPublishRun(),
|
|
1178
1244
|
workingDirectory: deployDirectory,
|
|
1179
1245
|
},
|
|
1180
1246
|
],
|
|
1181
1247
|
};
|
|
1182
1248
|
}
|
|
1249
|
+
static buildPfsenseTarget(context) {
|
|
1250
|
+
const targetSettings = context['targetSettings'];
|
|
1251
|
+
const workflowSettings = context['workflowSettings'];
|
|
1252
|
+
const metadata = Variables.getTargetMetadata('publish', 'pfsense');
|
|
1253
|
+
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1254
|
+
const environment = context['environment'];
|
|
1255
|
+
const appPath = context['workingDir'];
|
|
1256
|
+
const workspaceName = basename(context['workingDir']);
|
|
1257
|
+
const validateAndStageRun = [
|
|
1258
|
+
`node "${context['workingDir']}/scripts/check-package.mjs"`,
|
|
1259
|
+
`node "${context['workingDir']}/scripts/stage-package.mjs"`,
|
|
1260
|
+
].join('\n');
|
|
1261
|
+
const dollar = Runner.dollar();
|
|
1262
|
+
const escapedNewline = [
|
|
1263
|
+
'\\',
|
|
1264
|
+
'n',
|
|
1265
|
+
].join('');
|
|
1266
|
+
const stagedShareDirectory = `${context['workingDir']}/build/port/files/usr/local/share`;
|
|
1267
|
+
const releaseDirectory = `${context['workingDir']}/build/release`;
|
|
1268
|
+
const addSigningKeyRun = [
|
|
1269
|
+
'set -eu',
|
|
1270
|
+
'',
|
|
1271
|
+
`staged_share_directory="${stagedShareDirectory}"`,
|
|
1272
|
+
'',
|
|
1273
|
+
`if [ -z "${dollar}RELEASE_SIGNING_KEY:-}" ]; then`,
|
|
1274
|
+
' echo "::notice::The release signing secret is not set, so the package ships without a release signing key."',
|
|
1275
|
+
' exit 0',
|
|
1276
|
+
'fi',
|
|
1277
|
+
'',
|
|
1278
|
+
'umask 077',
|
|
1279
|
+
`key_directory="$(mktemp -d "${dollar}RUNNER_TEMP:-/tmp}/release-signing.XXXXXX")"`,
|
|
1280
|
+
'trap \'rm -rf "$key_directory"\' EXIT',
|
|
1281
|
+
`printf '%s${escapedNewline}' "$RELEASE_SIGNING_KEY" | tr -d '\\r' > "${dollar}key_directory}/signing-key"`,
|
|
1282
|
+
'',
|
|
1283
|
+
`if ! ssh-keygen -y -P '' -f "${dollar}key_directory}/signing-key" > "${dollar}key_directory}/signing-key.pub" 2> /dev/null; then`,
|
|
1284
|
+
' echo "::error::The release signing secret must be an unencrypted OpenSSH private key that starts with \\"-----BEGIN OPENSSH PRIVATE KEY-----\\"."',
|
|
1285
|
+
' exit 1',
|
|
1286
|
+
'fi',
|
|
1287
|
+
'',
|
|
1288
|
+
`public_key="$(awk '{ print $1 " " $2 }' "${dollar}key_directory}/signing-key.pub")"`,
|
|
1289
|
+
'',
|
|
1290
|
+
'case "$public_key" in',
|
|
1291
|
+
' "ssh-ed25519 "*)',
|
|
1292
|
+
' ;;',
|
|
1293
|
+
' *)',
|
|
1294
|
+
' echo "::error::The release signing secret must be an Ed25519 key."',
|
|
1295
|
+
' exit 1',
|
|
1296
|
+
' ;;',
|
|
1297
|
+
'esac',
|
|
1298
|
+
'',
|
|
1299
|
+
'key_file_count=0',
|
|
1300
|
+
'',
|
|
1301
|
+
`for public_key_file in "${dollar}staged_share_directory}"/*/release-signing.pub; do`,
|
|
1302
|
+
' if [ ! -f "$public_key_file" ]; then',
|
|
1303
|
+
' continue',
|
|
1304
|
+
' fi',
|
|
1305
|
+
'',
|
|
1306
|
+
' key_file_count=$((key_file_count + 1))',
|
|
1307
|
+
'',
|
|
1308
|
+
' if [ -s "$public_key_file" ] && [ -n "$(tail -c 1 "$public_key_file")" ]; then',
|
|
1309
|
+
` printf '${escapedNewline}' >> "$public_key_file"`,
|
|
1310
|
+
' fi',
|
|
1311
|
+
'',
|
|
1312
|
+
' if ! tr -d \'\\r\' < "$public_key_file" | awk \'{ print $1 " " $2 }\' | grep -Fxq "$public_key"; then',
|
|
1313
|
+
` printf '%s added by the publish workflow${escapedNewline}' "$public_key" >> "$public_key_file"`,
|
|
1314
|
+
' fi',
|
|
1315
|
+
'done',
|
|
1316
|
+
'',
|
|
1317
|
+
'if [ "$key_file_count" -eq 0 ]; then',
|
|
1318
|
+
' echo "::warning::The staged port has no usr/local/share/<package>/release-signing.pub file, so installed copies won\'t check release signatures."',
|
|
1319
|
+
'fi',
|
|
1320
|
+
'',
|
|
1321
|
+
].join('\n');
|
|
1322
|
+
const freebsdRun = [
|
|
1323
|
+
'git clone --depth 1 --single-branch --branch devel --filter=blob:none --sparse https://github.com/pfsense/FreeBSD-ports.git /usr/ports',
|
|
1324
|
+
'git -C /usr/ports sparse-checkout set Mk Templates Keywords',
|
|
1325
|
+
`PFSENSE_PORTS_DIR=/usr/ports sh "${context['workingDir']}/scripts/build-package.sh"`,
|
|
1326
|
+
].join('\n');
|
|
1327
|
+
const signReleaseRun = [
|
|
1328
|
+
'set -eu',
|
|
1329
|
+
'',
|
|
1330
|
+
`release_directory="${releaseDirectory}"`,
|
|
1331
|
+
`share_directory="${stagedShareDirectory}"`,
|
|
1332
|
+
'',
|
|
1333
|
+
'# Prints the key lines of a release-signing.pub file. Blank lines and "#"',
|
|
1334
|
+
'# comments are skipped, the same way the installed package reads the file.',
|
|
1335
|
+
'read_key_lines() {',
|
|
1336
|
+
' tr -d \'\\r\' < "$1" | sed -e \'s/^[[:space:]]*//\' -e \'s/[[:space:]]*$//\' | grep -v -e \'^$\' -e \'^#\' || true',
|
|
1337
|
+
'}',
|
|
1338
|
+
'',
|
|
1339
|
+
'package_count=0',
|
|
1340
|
+
'',
|
|
1341
|
+
`for package_file in "${dollar}release_directory}"/*.pkg; do`,
|
|
1342
|
+
' if [ -f "$package_file" ]; then',
|
|
1343
|
+
' package_count=$((package_count + 1))',
|
|
1344
|
+
' fi',
|
|
1345
|
+
'done',
|
|
1346
|
+
'',
|
|
1347
|
+
'if [ "$package_count" -eq 0 ]; then',
|
|
1348
|
+
` echo "::error::No .pkg files were found in ${dollar}release_directory}."`,
|
|
1349
|
+
' exit 1',
|
|
1350
|
+
'fi',
|
|
1351
|
+
'',
|
|
1352
|
+
`if [ -z "${dollar}RELEASE_SIGNING_KEY:-}" ]; then`,
|
|
1353
|
+
' echo "::notice::The release signing secret is not set, so the release packages are not signed."',
|
|
1354
|
+
' exit 0',
|
|
1355
|
+
'fi',
|
|
1356
|
+
'',
|
|
1357
|
+
'umask 077',
|
|
1358
|
+
`key_directory="$(mktemp -d "${dollar}RUNNER_TEMP:-/tmp}/release-signing.XXXXXX")"`,
|
|
1359
|
+
'trap \'rm -rf "$key_directory"\' EXIT',
|
|
1360
|
+
`printf '%s${escapedNewline}' "$RELEASE_SIGNING_KEY" | tr -d '\\r' > "${dollar}key_directory}/signing-key"`,
|
|
1361
|
+
'',
|
|
1362
|
+
`if ! ssh-keygen -y -P '' -f "${dollar}key_directory}/signing-key" > "${dollar}key_directory}/signing-key.pub" 2> /dev/null; then`,
|
|
1363
|
+
' echo "::error::The release signing secret must be an unencrypted OpenSSH private key that starts with \\"-----BEGIN OPENSSH PRIVATE KEY-----\\"."',
|
|
1364
|
+
' exit 1',
|
|
1365
|
+
'fi',
|
|
1366
|
+
'',
|
|
1367
|
+
`for package_file in "${dollar}release_directory}"/*.pkg; do`,
|
|
1368
|
+
' package_name="$(basename "$package_file" .pkg)"',
|
|
1369
|
+
'',
|
|
1370
|
+
' # Versioned files end in -<version>; a stable copy such as pfSense-pkg-Demo.pkg',
|
|
1371
|
+
' # already is the package name, so only a suffix that starts with a digit is removed.',
|
|
1372
|
+
` case "${dollar}package_name##*-}" in`,
|
|
1373
|
+
` [0-9]*) package_name="${dollar}package_name%-*}" ;;`,
|
|
1374
|
+
' esac',
|
|
1375
|
+
'',
|
|
1376
|
+
` public_key_file="${dollar}share_directory}/${dollar}package_name}/release-signing.pub"`,
|
|
1377
|
+
'',
|
|
1378
|
+
` rm -f "${dollar}package_file}.sig"`,
|
|
1379
|
+
` ssh-keygen -Y sign -f "${dollar}key_directory}/signing-key" -n "$package_name" "$package_file"`,
|
|
1380
|
+
'',
|
|
1381
|
+
' key_lines=""',
|
|
1382
|
+
'',
|
|
1383
|
+
' if [ -f "$public_key_file" ]; then',
|
|
1384
|
+
' key_lines="$(read_key_lines "$public_key_file")"',
|
|
1385
|
+
' fi',
|
|
1386
|
+
'',
|
|
1387
|
+
' if [ -z "$key_lines" ]; then',
|
|
1388
|
+
` echo "::warning::${dollar}package_name} lists no key in release-signing.pub, so installed copies won't check this signature."`,
|
|
1389
|
+
' continue',
|
|
1390
|
+
' fi',
|
|
1391
|
+
'',
|
|
1392
|
+
` : > "${dollar}key_directory}/allowed_signers"`,
|
|
1393
|
+
'',
|
|
1394
|
+
' while IFS= read -r key_line; do',
|
|
1395
|
+
` if ! printf '%s${escapedNewline}' "$key_line" | grep -Eq '^ssh-ed25519[[:space:]]+AAAAC3NzaC1lZDI1NTE5AAAAI[A-Za-z0-9+/]{43}([[:space:]].*)?$'; then`,
|
|
1396
|
+
` echo "::error::${dollar}public_key_file} has a line that isn't an \\"ssh-ed25519\\" public key."`,
|
|
1397
|
+
' exit 1',
|
|
1398
|
+
' fi',
|
|
1399
|
+
'',
|
|
1400
|
+
` key_data="$(printf '%s${escapedNewline}' "$key_line" | awk '{ print $2 }')"`,
|
|
1401
|
+
` printf '%s namespaces="%s" ssh-ed25519 %s${escapedNewline}' "$package_name" "$package_name" "$key_data" >> "${dollar}key_directory}/allowed_signers"`,
|
|
1402
|
+
' done <<KEY_LINES',
|
|
1403
|
+
`${dollar}key_lines}`,
|
|
1404
|
+
'KEY_LINES',
|
|
1405
|
+
'',
|
|
1406
|
+
` if ! ssh-keygen -Y verify -f "${dollar}key_directory}/allowed_signers" -I "$package_name" -n "$package_name" -s "${dollar}package_file}.sig" < "$package_file"; then`,
|
|
1407
|
+
` echo "::error::The release signing secret doesn't match a key in ${dollar}public_key_file}."`,
|
|
1408
|
+
' exit 1',
|
|
1409
|
+
' fi',
|
|
1410
|
+
'done',
|
|
1411
|
+
'',
|
|
1412
|
+
].join('\n');
|
|
1413
|
+
const releaseSigningKey = Runner.resolveScopedCredExpr(variables, 'RELEASE_SIGNING_KEY', targetSettings, workflowSettings, environment, appPath);
|
|
1414
|
+
return {
|
|
1415
|
+
id: `publish-pfsense-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1416
|
+
needs: context['needs'],
|
|
1417
|
+
runsOn: 'ubuntu-latest',
|
|
1418
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1419
|
+
permissions: {
|
|
1420
|
+
contents: 'write',
|
|
1421
|
+
},
|
|
1422
|
+
steps: [
|
|
1423
|
+
{
|
|
1424
|
+
name: 'Checkout repository',
|
|
1425
|
+
kind: 'checkout',
|
|
1426
|
+
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
name: 'Validate and stage port',
|
|
1430
|
+
kind: 'check',
|
|
1431
|
+
run: validateAndStageRun,
|
|
1432
|
+
runBlock: true,
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
name: 'Add release signing key',
|
|
1436
|
+
kind: 'attest',
|
|
1437
|
+
env: [{
|
|
1438
|
+
key: 'RELEASE_SIGNING_KEY',
|
|
1439
|
+
value: releaseSigningKey,
|
|
1440
|
+
}],
|
|
1441
|
+
run: addSigningKeyRun,
|
|
1442
|
+
runBlock: true,
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
name: 'Build on FreeBSD',
|
|
1446
|
+
kind: 'build',
|
|
1447
|
+
uses: getScaffoldVersion('workflowActionFreebsdVm'),
|
|
1448
|
+
with: [
|
|
1449
|
+
{
|
|
1450
|
+
key: 'release',
|
|
1451
|
+
value: Runner.expr('vars.PFSENSE_FREEBSD_VERSION || \'15\''),
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
key: 'copyback',
|
|
1455
|
+
value: true,
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
key: 'prepare',
|
|
1459
|
+
value: 'pkg install -y ca_root_nss git',
|
|
1460
|
+
block: true,
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
key: 'run',
|
|
1464
|
+
value: freebsdRun,
|
|
1465
|
+
block: true,
|
|
1466
|
+
},
|
|
1467
|
+
],
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
name: 'Sign release packages',
|
|
1471
|
+
kind: 'attest',
|
|
1472
|
+
env: [{
|
|
1473
|
+
key: 'RELEASE_SIGNING_KEY',
|
|
1474
|
+
value: releaseSigningKey,
|
|
1475
|
+
}],
|
|
1476
|
+
run: signReleaseRun,
|
|
1477
|
+
runBlock: true,
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
name: 'Upload workflow artifact',
|
|
1481
|
+
kind: 'artifact',
|
|
1482
|
+
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
1483
|
+
with: [
|
|
1484
|
+
{
|
|
1485
|
+
key: 'name',
|
|
1486
|
+
value: `pfsense-${workspaceName}`,
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
key: 'path',
|
|
1490
|
+
value: `${releaseDirectory}/*`,
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
key: 'if-no-files-found',
|
|
1494
|
+
value: 'error',
|
|
1495
|
+
},
|
|
1496
|
+
{
|
|
1497
|
+
key: 'retention-days',
|
|
1498
|
+
value: 7,
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
key: 'include-hidden-files',
|
|
1502
|
+
value: true,
|
|
1503
|
+
},
|
|
1504
|
+
],
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
name: 'Upload GitHub release assets',
|
|
1508
|
+
kind: 'deploy',
|
|
1509
|
+
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1510
|
+
env: [
|
|
1511
|
+
{
|
|
1512
|
+
key: 'GH_TOKEN',
|
|
1513
|
+
value: Runner.expr('github.token'),
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
key: 'RELEASE_TAG',
|
|
1517
|
+
value: Runner.expr('github.event.release.tag_name || inputs.tag'),
|
|
1518
|
+
},
|
|
1519
|
+
],
|
|
1520
|
+
run: `gh release upload "$RELEASE_TAG" "${releaseDirectory}/"* --clobber`,
|
|
1521
|
+
runBlock: true,
|
|
1522
|
+
},
|
|
1523
|
+
],
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1183
1526
|
static buildGithubPackagesTarget(context) {
|
|
1184
1527
|
const targetSettings = context['targetSettings'];
|
|
1185
1528
|
const workflowSettings = context['workflowSettings'];
|
|
@@ -1190,7 +1533,7 @@ export class Runner {
|
|
|
1190
1533
|
id: `publish-github-packages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1191
1534
|
needs: context['needs'],
|
|
1192
1535
|
runsOn: 'ubuntu-latest',
|
|
1193
|
-
timeoutMinutes:
|
|
1536
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1194
1537
|
permissions: {
|
|
1195
1538
|
'contents': 'read',
|
|
1196
1539
|
'packages': 'write',
|
|
@@ -1199,10 +1542,12 @@ export class Runner {
|
|
|
1199
1542
|
steps: [
|
|
1200
1543
|
{
|
|
1201
1544
|
name: 'Checkout repository',
|
|
1545
|
+
kind: 'checkout',
|
|
1202
1546
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1203
1547
|
},
|
|
1204
1548
|
{
|
|
1205
1549
|
name: 'Setup Node.js',
|
|
1550
|
+
kind: 'setup',
|
|
1206
1551
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1207
1552
|
with: [
|
|
1208
1553
|
{
|
|
@@ -1217,6 +1562,7 @@ export class Runner {
|
|
|
1217
1562
|
},
|
|
1218
1563
|
{
|
|
1219
1564
|
name: 'Configure registry for GitHub Packages',
|
|
1565
|
+
kind: 'registry',
|
|
1220
1566
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1221
1567
|
with: [
|
|
1222
1568
|
{
|
|
@@ -1239,10 +1585,12 @@ export class Runner {
|
|
|
1239
1585
|
},
|
|
1240
1586
|
{
|
|
1241
1587
|
name: 'Remove deprecated .npmrc entries',
|
|
1588
|
+
kind: 'setup',
|
|
1242
1589
|
run: Runner.removeDeprecatedNpmrcRun(),
|
|
1243
1590
|
},
|
|
1244
1591
|
{
|
|
1245
1592
|
name: 'Download build artifacts',
|
|
1593
|
+
kind: 'artifact',
|
|
1246
1594
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1247
1595
|
with: [
|
|
1248
1596
|
{
|
|
@@ -1257,11 +1605,13 @@ export class Runner {
|
|
|
1257
1605
|
},
|
|
1258
1606
|
{
|
|
1259
1607
|
name: 'Change to scoped package name',
|
|
1608
|
+
kind: 'setup',
|
|
1260
1609
|
run: Runner.scopePackageNameRun(),
|
|
1261
1610
|
workingDirectory: deployDirectory,
|
|
1262
1611
|
},
|
|
1263
1612
|
{
|
|
1264
1613
|
name: 'Configure authentication',
|
|
1614
|
+
kind: 'registry',
|
|
1265
1615
|
env: [{
|
|
1266
1616
|
key: 'GITHUB_TOKEN',
|
|
1267
1617
|
value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
|
|
@@ -1270,11 +1620,13 @@ export class Runner {
|
|
|
1270
1620
|
},
|
|
1271
1621
|
{
|
|
1272
1622
|
name: 'Publish package to GitHub Packages',
|
|
1623
|
+
kind: 'deploy',
|
|
1273
1624
|
run: Runner.githubPublishRun(),
|
|
1274
1625
|
workingDirectory: deployDirectory,
|
|
1275
1626
|
},
|
|
1276
1627
|
{
|
|
1277
1628
|
name: 'Restore package name',
|
|
1629
|
+
kind: 'setup',
|
|
1278
1630
|
if: Runner.expr('always() && env.PACKAGE_NAME'),
|
|
1279
1631
|
run: 'npm pkg set name="$PACKAGE_NAME"',
|
|
1280
1632
|
runBlock: true,
|
|
@@ -1295,17 +1647,19 @@ export class Runner {
|
|
|
1295
1647
|
id: `publish-cloudflare-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1296
1648
|
needs: context['needs'],
|
|
1297
1649
|
runsOn: 'ubuntu-latest',
|
|
1298
|
-
timeoutMinutes:
|
|
1650
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1299
1651
|
permissions: {
|
|
1300
1652
|
contents: 'read',
|
|
1301
1653
|
},
|
|
1302
1654
|
steps: [
|
|
1303
1655
|
{
|
|
1304
1656
|
name: 'Checkout repository',
|
|
1657
|
+
kind: 'checkout',
|
|
1305
1658
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1306
1659
|
},
|
|
1307
1660
|
{
|
|
1308
1661
|
name: 'Setup Node.js',
|
|
1662
|
+
kind: 'setup',
|
|
1309
1663
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1310
1664
|
with: [
|
|
1311
1665
|
{
|
|
@@ -1320,10 +1674,12 @@ export class Runner {
|
|
|
1320
1674
|
},
|
|
1321
1675
|
...((context['packageManager'] === 'npm') ? [] : [{
|
|
1322
1676
|
name: 'Install Corepack',
|
|
1677
|
+
kind: 'install',
|
|
1323
1678
|
run: Runner.corepackBootstrapRun(context['packageManager']),
|
|
1324
1679
|
}]),
|
|
1325
1680
|
{
|
|
1326
1681
|
name: 'Download build artifacts',
|
|
1682
|
+
kind: 'artifact',
|
|
1327
1683
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1328
1684
|
with: [
|
|
1329
1685
|
{
|
|
@@ -1338,6 +1694,7 @@ export class Runner {
|
|
|
1338
1694
|
},
|
|
1339
1695
|
{
|
|
1340
1696
|
name: 'Deploy to Cloudflare Pages',
|
|
1697
|
+
kind: 'deploy',
|
|
1341
1698
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1342
1699
|
env: [
|
|
1343
1700
|
{
|
|
@@ -1387,10 +1744,12 @@ export class Runner {
|
|
|
1387
1744
|
const steps = [
|
|
1388
1745
|
{
|
|
1389
1746
|
name: 'Checkout repository',
|
|
1747
|
+
kind: 'checkout',
|
|
1390
1748
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1391
1749
|
},
|
|
1392
1750
|
{
|
|
1393
1751
|
name: 'Setup Node.js',
|
|
1752
|
+
kind: 'setup',
|
|
1394
1753
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1395
1754
|
with: [
|
|
1396
1755
|
{
|
|
@@ -1405,11 +1764,13 @@ export class Runner {
|
|
|
1405
1764
|
},
|
|
1406
1765
|
{
|
|
1407
1766
|
name: 'Install packages',
|
|
1767
|
+
kind: 'install',
|
|
1408
1768
|
run: Runner.installPackagesRun(context['packageManager']),
|
|
1409
1769
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
1410
1770
|
},
|
|
1411
1771
|
{
|
|
1412
1772
|
name: 'Download build artifacts',
|
|
1773
|
+
kind: 'artifact',
|
|
1413
1774
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1414
1775
|
with: [
|
|
1415
1776
|
{
|
|
@@ -1424,6 +1785,7 @@ export class Runner {
|
|
|
1424
1785
|
},
|
|
1425
1786
|
{
|
|
1426
1787
|
name: 'Deploy to Cloudflare Workers',
|
|
1788
|
+
kind: 'deploy',
|
|
1427
1789
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1428
1790
|
env: deployEnv,
|
|
1429
1791
|
run: deployRun,
|
|
@@ -1457,7 +1819,7 @@ export class Runner {
|
|
|
1457
1819
|
id: `publish-cloudflare-workers-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1458
1820
|
needs: context['needs'],
|
|
1459
1821
|
runsOn: 'ubuntu-latest',
|
|
1460
|
-
timeoutMinutes:
|
|
1822
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1461
1823
|
permissions: {
|
|
1462
1824
|
contents: 'read',
|
|
1463
1825
|
},
|
|
@@ -1471,8 +1833,11 @@ export class Runner {
|
|
|
1471
1833
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1472
1834
|
const environment = context['environment'];
|
|
1473
1835
|
const appPath = context['workingDir'];
|
|
1474
|
-
const
|
|
1475
|
-
const
|
|
1836
|
+
const dockerHub = context['dockerHub'];
|
|
1837
|
+
const imageNamespace = dockerHub['namespace'];
|
|
1838
|
+
const imageRepository = dockerHub['repository'];
|
|
1839
|
+
const dockerHubUsername = Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_USERNAME', targetSettings, workflowSettings, environment, appPath);
|
|
1840
|
+
const dockerHubToken = Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_TOKEN', targetSettings, workflowSettings, environment, appPath);
|
|
1476
1841
|
return Runner.buildContainerRegistryTarget(context, {
|
|
1477
1842
|
registrySlug: 'docker-hub',
|
|
1478
1843
|
registryHost: 'docker.io',
|
|
@@ -1480,15 +1845,16 @@ export class Runner {
|
|
|
1480
1845
|
imageRepository,
|
|
1481
1846
|
loginStep: {
|
|
1482
1847
|
name: 'Login to Docker Hub',
|
|
1848
|
+
kind: 'registry',
|
|
1483
1849
|
uses: getScaffoldVersion('workflowActionDockerLogin'),
|
|
1484
1850
|
env: [{
|
|
1485
1851
|
key: 'DOCKERHUB_TOKEN',
|
|
1486
|
-
value:
|
|
1852
|
+
value: dockerHubToken,
|
|
1487
1853
|
}],
|
|
1488
1854
|
with: [
|
|
1489
1855
|
{
|
|
1490
1856
|
key: 'username',
|
|
1491
|
-
value:
|
|
1857
|
+
value: dockerHubUsername,
|
|
1492
1858
|
},
|
|
1493
1859
|
{
|
|
1494
1860
|
key: 'password',
|
|
@@ -1512,6 +1878,7 @@ export class Runner {
|
|
|
1512
1878
|
imageRepository,
|
|
1513
1879
|
loginStep: {
|
|
1514
1880
|
name: 'Login to GitHub Container Registry',
|
|
1881
|
+
kind: 'registry',
|
|
1515
1882
|
uses: getScaffoldVersion('workflowActionDockerLogin'),
|
|
1516
1883
|
with: [
|
|
1517
1884
|
{
|
|
@@ -1550,7 +1917,7 @@ export class Runner {
|
|
|
1550
1917
|
id: `publish-github-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1551
1918
|
needs: context['needs'],
|
|
1552
1919
|
runsOn: 'ubuntu-latest',
|
|
1553
|
-
timeoutMinutes:
|
|
1920
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1554
1921
|
permissions: {
|
|
1555
1922
|
'contents': 'read',
|
|
1556
1923
|
'pages': 'write',
|
|
@@ -1559,10 +1926,12 @@ export class Runner {
|
|
|
1559
1926
|
steps: [
|
|
1560
1927
|
{
|
|
1561
1928
|
name: 'Checkout repository',
|
|
1929
|
+
kind: 'checkout',
|
|
1562
1930
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1563
1931
|
},
|
|
1564
1932
|
{
|
|
1565
1933
|
name: 'Download build artifacts',
|
|
1934
|
+
kind: 'artifact',
|
|
1566
1935
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1567
1936
|
with: [
|
|
1568
1937
|
{
|
|
@@ -1577,6 +1946,7 @@ export class Runner {
|
|
|
1577
1946
|
},
|
|
1578
1947
|
{
|
|
1579
1948
|
name: 'Check GitHub Pages status',
|
|
1949
|
+
kind: 'check',
|
|
1580
1950
|
env: [{
|
|
1581
1951
|
key: 'GITHUB_TOKEN',
|
|
1582
1952
|
value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
|
|
@@ -1586,11 +1956,13 @@ export class Runner {
|
|
|
1586
1956
|
},
|
|
1587
1957
|
{
|
|
1588
1958
|
name: 'Setup GitHub Pages',
|
|
1959
|
+
kind: 'setup',
|
|
1589
1960
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1590
1961
|
uses: getScaffoldVersion('workflowActionConfigurePages'),
|
|
1591
1962
|
},
|
|
1592
1963
|
{
|
|
1593
1964
|
name: 'Upload artifact to GitHub Pages',
|
|
1965
|
+
kind: 'artifact',
|
|
1594
1966
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1595
1967
|
uses: getScaffoldVersion('workflowActionUploadPagesArtifact'),
|
|
1596
1968
|
with: [{
|
|
@@ -1600,6 +1972,7 @@ export class Runner {
|
|
|
1600
1972
|
},
|
|
1601
1973
|
{
|
|
1602
1974
|
name: 'Deploy to GitHub Pages',
|
|
1975
|
+
kind: 'deploy',
|
|
1603
1976
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1604
1977
|
uses: getScaffoldVersion('workflowActionDeployPages'),
|
|
1605
1978
|
},
|
|
@@ -1724,7 +2097,7 @@ export class Runner {
|
|
|
1724
2097
|
id: `publish-github-action-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1725
2098
|
needs: context['needs'],
|
|
1726
2099
|
runsOn: 'ubuntu-latest',
|
|
1727
|
-
timeoutMinutes:
|
|
2100
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1728
2101
|
permissions: {
|
|
1729
2102
|
'contents': 'write',
|
|
1730
2103
|
'id-token': 'write',
|
|
@@ -1733,6 +2106,7 @@ export class Runner {
|
|
|
1733
2106
|
steps: [
|
|
1734
2107
|
{
|
|
1735
2108
|
name: 'Checkout repository',
|
|
2109
|
+
kind: 'checkout',
|
|
1736
2110
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1737
2111
|
with: [{
|
|
1738
2112
|
key: 'persist-credentials',
|
|
@@ -1741,6 +2115,7 @@ export class Runner {
|
|
|
1741
2115
|
},
|
|
1742
2116
|
{
|
|
1743
2117
|
name: 'Download build artifacts',
|
|
2118
|
+
kind: 'artifact',
|
|
1744
2119
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1745
2120
|
with: [
|
|
1746
2121
|
{
|
|
@@ -1755,11 +2130,13 @@ export class Runner {
|
|
|
1755
2130
|
},
|
|
1756
2131
|
{
|
|
1757
2132
|
name: 'Configure git identity',
|
|
2133
|
+
kind: 'setup',
|
|
1758
2134
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1759
2135
|
run: configureGitIdentityRun,
|
|
1760
2136
|
},
|
|
1761
2137
|
{
|
|
1762
2138
|
name: 'Verify release context',
|
|
2139
|
+
kind: 'check',
|
|
1763
2140
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1764
2141
|
env: [{
|
|
1765
2142
|
key: 'TAG_NAME',
|
|
@@ -1769,6 +2146,7 @@ export class Runner {
|
|
|
1769
2146
|
},
|
|
1770
2147
|
{
|
|
1771
2148
|
name: 'Initialize release workspace',
|
|
2149
|
+
kind: 'setup',
|
|
1772
2150
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1773
2151
|
env: [
|
|
1774
2152
|
{
|
|
@@ -1784,11 +2162,13 @@ export class Runner {
|
|
|
1784
2162
|
},
|
|
1785
2163
|
{
|
|
1786
2164
|
name: 'Stage release tree',
|
|
2165
|
+
kind: 'setup',
|
|
1787
2166
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1788
2167
|
run: stageReleaseTreeRun,
|
|
1789
2168
|
},
|
|
1790
2169
|
{
|
|
1791
2170
|
name: 'Commit and push release',
|
|
2171
|
+
kind: 'deploy',
|
|
1792
2172
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1793
2173
|
env: [{
|
|
1794
2174
|
key: 'TAG_NAME',
|
|
@@ -1798,6 +2178,7 @@ export class Runner {
|
|
|
1798
2178
|
},
|
|
1799
2179
|
{
|
|
1800
2180
|
name: 'Force-retag semver and floating major',
|
|
2181
|
+
kind: 'deploy',
|
|
1801
2182
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1802
2183
|
env: [
|
|
1803
2184
|
{
|
|
@@ -1813,6 +2194,7 @@ export class Runner {
|
|
|
1813
2194
|
},
|
|
1814
2195
|
{
|
|
1815
2196
|
name: 'Attest build provenance',
|
|
2197
|
+
kind: 'attest',
|
|
1816
2198
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1817
2199
|
uses: getScaffoldVersion('workflowActionAttest'),
|
|
1818
2200
|
with: [{
|
|
@@ -1836,10 +2218,12 @@ export class Runner {
|
|
|
1836
2218
|
const steps = [
|
|
1837
2219
|
{
|
|
1838
2220
|
name: 'Checkout repository',
|
|
2221
|
+
kind: 'checkout',
|
|
1839
2222
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1840
2223
|
},
|
|
1841
2224
|
{
|
|
1842
2225
|
name: 'Setup Node.js',
|
|
2226
|
+
kind: 'setup',
|
|
1843
2227
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1844
2228
|
with: [
|
|
1845
2229
|
{
|
|
@@ -1854,6 +2238,7 @@ export class Runner {
|
|
|
1854
2238
|
},
|
|
1855
2239
|
{
|
|
1856
2240
|
name: 'Download build artifacts',
|
|
2241
|
+
kind: 'artifact',
|
|
1857
2242
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1858
2243
|
with: [
|
|
1859
2244
|
{
|
|
@@ -1868,12 +2253,14 @@ export class Runner {
|
|
|
1868
2253
|
},
|
|
1869
2254
|
{
|
|
1870
2255
|
name: 'Install Vercel CLI',
|
|
2256
|
+
kind: 'install',
|
|
1871
2257
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1872
2258
|
run: 'npm install -g vercel@latest',
|
|
1873
2259
|
runPlain: true,
|
|
1874
2260
|
},
|
|
1875
2261
|
{
|
|
1876
2262
|
name: 'Pull Vercel environment',
|
|
2263
|
+
kind: 'setup',
|
|
1877
2264
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1878
2265
|
env: [
|
|
1879
2266
|
{
|
|
@@ -1896,6 +2283,7 @@ export class Runner {
|
|
|
1896
2283
|
];
|
|
1897
2284
|
const deployStep = {
|
|
1898
2285
|
name: 'Deploy to Vercel',
|
|
2286
|
+
kind: 'deploy',
|
|
1899
2287
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1900
2288
|
env: [
|
|
1901
2289
|
{
|
|
@@ -1933,7 +2321,7 @@ export class Runner {
|
|
|
1933
2321
|
id: `publish-vercel-nextjs-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1934
2322
|
needs: context['needs'],
|
|
1935
2323
|
runsOn: 'ubuntu-latest',
|
|
1936
|
-
timeoutMinutes:
|
|
2324
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1937
2325
|
permissions: {
|
|
1938
2326
|
contents: 'read',
|
|
1939
2327
|
},
|
|
@@ -2038,31 +2426,56 @@ export class Runner {
|
|
|
2038
2426
|
];
|
|
2039
2427
|
return {
|
|
2040
2428
|
name,
|
|
2429
|
+
kind: 'check',
|
|
2041
2430
|
run: lines.join('\n'),
|
|
2042
2431
|
runBlock: true,
|
|
2043
2432
|
};
|
|
2044
2433
|
}
|
|
2045
|
-
static
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
{
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
{
|
|
2434
|
+
static buildContainerJobs(platforms, timeoutMinutes, checkoutRef) {
|
|
2435
|
+
const labels = [
|
|
2436
|
+
`org.opencontainers.image.version=${Runner.expr('github.event.release.tag_name || inputs.tag || github.ref_name')}`,
|
|
2437
|
+
`org.opencontainers.image.revision=${Runner.expr('github.sha')}`,
|
|
2438
|
+
].join('\n');
|
|
2439
|
+
const jobs = [];
|
|
2440
|
+
const platformJobIds = [];
|
|
2441
|
+
for (const platform of platforms) {
|
|
2442
|
+
const platformSlug = platform.replace(new RegExp(LIB_REGEX_PATTERN_NON_ALPHANUMERIC_RUN, 'g'), '-');
|
|
2443
|
+
const platformJobId = `build-container-${platformSlug}`;
|
|
2444
|
+
const nativeArchitecture = libWorkflowContainerPlatformArchitectures[platform];
|
|
2445
|
+
const cacheScope = `container-${platformSlug}`;
|
|
2446
|
+
const platformSteps = [{
|
|
2447
|
+
name: 'Checkout repository',
|
|
2448
|
+
kind: 'checkout',
|
|
2449
|
+
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
2450
|
+
...((checkoutRef === undefined) ? {} : {
|
|
2451
|
+
with: [{
|
|
2452
|
+
key: 'ref',
|
|
2453
|
+
value: checkoutRef,
|
|
2454
|
+
}],
|
|
2455
|
+
}),
|
|
2456
|
+
}];
|
|
2457
|
+
if (nativeArchitecture === undefined) {
|
|
2458
|
+
platformSteps.push({
|
|
2459
|
+
name: 'Set up QEMU',
|
|
2460
|
+
kind: 'setup',
|
|
2461
|
+
uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
|
|
2462
|
+
with: [{
|
|
2463
|
+
key: 'platforms',
|
|
2464
|
+
value: platform,
|
|
2465
|
+
}],
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
platformSteps.push({
|
|
2057
2469
|
name: 'Set up Docker Buildx',
|
|
2470
|
+
kind: 'setup',
|
|
2058
2471
|
uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
|
|
2059
|
-
},
|
|
2060
|
-
{
|
|
2472
|
+
}, {
|
|
2061
2473
|
name: 'Prepare OCI handoff',
|
|
2474
|
+
kind: 'setup',
|
|
2062
2475
|
run: 'mkdir -p "$RUNNER_TEMP/container-oci"',
|
|
2063
|
-
},
|
|
2064
|
-
{
|
|
2476
|
+
}, {
|
|
2065
2477
|
name: 'Build immutable OCI artifact',
|
|
2478
|
+
kind: 'build',
|
|
2066
2479
|
id: 'build-oci',
|
|
2067
2480
|
uses: getScaffoldVersion('workflowActionDockerBuildPush'),
|
|
2068
2481
|
with: [
|
|
@@ -2072,7 +2485,7 @@ export class Runner {
|
|
|
2072
2485
|
},
|
|
2073
2486
|
{
|
|
2074
2487
|
key: 'platforms',
|
|
2075
|
-
value:
|
|
2488
|
+
value: platform,
|
|
2076
2489
|
},
|
|
2077
2490
|
{
|
|
2078
2491
|
key: 'push',
|
|
@@ -2086,24 +2499,36 @@ export class Runner {
|
|
|
2086
2499
|
key: 'tags',
|
|
2087
2500
|
value: 'nova.local/container:nova-oci',
|
|
2088
2501
|
},
|
|
2502
|
+
{
|
|
2503
|
+
key: 'labels',
|
|
2504
|
+
value: labels,
|
|
2505
|
+
block: true,
|
|
2506
|
+
},
|
|
2507
|
+
{
|
|
2508
|
+
key: 'cache-from',
|
|
2509
|
+
value: `type=gha,scope=${cacheScope}`,
|
|
2510
|
+
},
|
|
2511
|
+
{
|
|
2512
|
+
key: 'cache-to',
|
|
2513
|
+
value: `type=gha,mode=max,scope=${cacheScope}`,
|
|
2514
|
+
},
|
|
2089
2515
|
{
|
|
2090
2516
|
key: 'outputs',
|
|
2091
2517
|
value: `type=oci,dest=${Runner.expr('runner.temp')}/container-oci/layout,tar=false`,
|
|
2092
2518
|
},
|
|
2093
2519
|
],
|
|
2094
|
-
},
|
|
2095
|
-
{
|
|
2520
|
+
}, {
|
|
2096
2521
|
name: 'Record OCI digest',
|
|
2522
|
+
kind: 'artifact',
|
|
2097
2523
|
run: `printf '%s' '${Runner.expr('steps.build-oci.outputs.digest')}' > "$RUNNER_TEMP/container-oci/container-image.digest"`,
|
|
2098
|
-
},
|
|
2099
|
-
Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')),
|
|
2100
|
-
{
|
|
2524
|
+
}, Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')), {
|
|
2101
2525
|
name: 'Upload immutable OCI artifact',
|
|
2526
|
+
kind: 'artifact',
|
|
2102
2527
|
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
2103
2528
|
with: [
|
|
2104
2529
|
{
|
|
2105
2530
|
key: 'name',
|
|
2106
|
-
value:
|
|
2531
|
+
value: `container-oci-${platformSlug}`,
|
|
2107
2532
|
},
|
|
2108
2533
|
{
|
|
2109
2534
|
key: 'retention-days',
|
|
@@ -2122,8 +2547,94 @@ export class Runner {
|
|
|
2122
2547
|
value: `${Runner.expr('runner.temp')}/container-oci`,
|
|
2123
2548
|
},
|
|
2124
2549
|
],
|
|
2550
|
+
});
|
|
2551
|
+
jobs.push({
|
|
2552
|
+
id: platformJobId,
|
|
2553
|
+
runsOn: 'ubuntu-latest',
|
|
2554
|
+
...((nativeArchitecture === undefined) ? {} : {
|
|
2555
|
+
runnerArchitecture: nativeArchitecture,
|
|
2556
|
+
}),
|
|
2557
|
+
timeoutMinutes,
|
|
2558
|
+
permissions: {
|
|
2559
|
+
contents: 'read',
|
|
2560
|
+
},
|
|
2561
|
+
steps: platformSteps,
|
|
2562
|
+
});
|
|
2563
|
+
platformJobIds.push(platformJobId);
|
|
2564
|
+
}
|
|
2565
|
+
jobs.push({
|
|
2566
|
+
id: 'build-container',
|
|
2567
|
+
needs: [
|
|
2568
|
+
'build',
|
|
2569
|
+
...platformJobIds,
|
|
2570
|
+
],
|
|
2571
|
+
runsOn: 'ubuntu-latest',
|
|
2572
|
+
timeoutMinutes,
|
|
2573
|
+
permissions: {
|
|
2574
|
+
contents: 'read',
|
|
2125
2575
|
},
|
|
2126
|
-
|
|
2576
|
+
steps: [
|
|
2577
|
+
{
|
|
2578
|
+
name: 'Download per-platform OCI artifacts',
|
|
2579
|
+
kind: 'artifact',
|
|
2580
|
+
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
2581
|
+
with: [
|
|
2582
|
+
{
|
|
2583
|
+
key: 'pattern',
|
|
2584
|
+
value: 'container-oci-*',
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
key: 'path',
|
|
2588
|
+
value: `${Runner.expr('runner.temp')}/container-oci-platforms`,
|
|
2589
|
+
},
|
|
2590
|
+
],
|
|
2591
|
+
},
|
|
2592
|
+
{
|
|
2593
|
+
name: 'Set up ORAS',
|
|
2594
|
+
kind: 'setup',
|
|
2595
|
+
uses: getScaffoldVersion('workflowActionSetupOras'),
|
|
2596
|
+
with: [{
|
|
2597
|
+
key: 'version',
|
|
2598
|
+
value: '1.3.3',
|
|
2599
|
+
}],
|
|
2600
|
+
},
|
|
2601
|
+
{
|
|
2602
|
+
name: 'Merge per-platform images',
|
|
2603
|
+
kind: 'build',
|
|
2604
|
+
run: Runner.mergeContainerArtifactsRun(),
|
|
2605
|
+
runBlock: true,
|
|
2606
|
+
},
|
|
2607
|
+
Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')),
|
|
2608
|
+
{
|
|
2609
|
+
name: 'Upload immutable OCI artifact',
|
|
2610
|
+
kind: 'artifact',
|
|
2611
|
+
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
2612
|
+
with: [
|
|
2613
|
+
{
|
|
2614
|
+
key: 'name',
|
|
2615
|
+
value: 'container-oci',
|
|
2616
|
+
},
|
|
2617
|
+
{
|
|
2618
|
+
key: 'retention-days',
|
|
2619
|
+
value: 1,
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
key: 'include-hidden-files',
|
|
2623
|
+
value: true,
|
|
2624
|
+
},
|
|
2625
|
+
{
|
|
2626
|
+
key: 'if-no-files-found',
|
|
2627
|
+
value: 'error',
|
|
2628
|
+
},
|
|
2629
|
+
{
|
|
2630
|
+
key: 'path',
|
|
2631
|
+
value: `${Runner.expr('runner.temp')}/container-oci`,
|
|
2632
|
+
},
|
|
2633
|
+
],
|
|
2634
|
+
},
|
|
2635
|
+
],
|
|
2636
|
+
});
|
|
2637
|
+
return jobs;
|
|
2127
2638
|
}
|
|
2128
2639
|
static buildContainerRegistryTarget(context, config) {
|
|
2129
2640
|
const registrySlug = config['registrySlug'];
|
|
@@ -2132,6 +2643,7 @@ export class Runner {
|
|
|
2132
2643
|
const imageRepository = config['imageRepository'];
|
|
2133
2644
|
const loginStep = config['loginStep'];
|
|
2134
2645
|
const extraPermissions = config['extraPermissions'];
|
|
2646
|
+
const postAttestationSteps = config['postAttestationSteps'] ?? [];
|
|
2135
2647
|
const resolveTagsRun = Runner.resolveContainerTagsRun();
|
|
2136
2648
|
const checkImmutableTagsRun = Runner.checkImmutableContainerTagsRun();
|
|
2137
2649
|
const pushRun = Runner.pushContainerArtifactRun();
|
|
@@ -2142,7 +2654,7 @@ export class Runner {
|
|
|
2142
2654
|
id: `publish-${registrySlug}-root`,
|
|
2143
2655
|
needs: context['needs'],
|
|
2144
2656
|
runsOn: 'ubuntu-latest',
|
|
2145
|
-
timeoutMinutes:
|
|
2657
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
2146
2658
|
permissions: {
|
|
2147
2659
|
'contents': 'read',
|
|
2148
2660
|
...extraPermissions,
|
|
@@ -2153,6 +2665,7 @@ export class Runner {
|
|
|
2153
2665
|
steps: [
|
|
2154
2666
|
{
|
|
2155
2667
|
name: 'Download immutable OCI artifact',
|
|
2668
|
+
kind: 'artifact',
|
|
2156
2669
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
2157
2670
|
with: [
|
|
2158
2671
|
{
|
|
@@ -2167,6 +2680,7 @@ export class Runner {
|
|
|
2167
2680
|
},
|
|
2168
2681
|
{
|
|
2169
2682
|
name: 'Set up ORAS',
|
|
2683
|
+
kind: 'setup',
|
|
2170
2684
|
uses: getScaffoldVersion('workflowActionSetupOras'),
|
|
2171
2685
|
with: [{
|
|
2172
2686
|
key: 'version',
|
|
@@ -2175,6 +2689,7 @@ export class Runner {
|
|
|
2175
2689
|
},
|
|
2176
2690
|
{
|
|
2177
2691
|
name: 'Resolve image coordinate and tags',
|
|
2692
|
+
kind: 'setup',
|
|
2178
2693
|
env: [
|
|
2179
2694
|
{
|
|
2180
2695
|
key: 'EVENT_NAME',
|
|
@@ -2231,30 +2746,35 @@ export class Runner {
|
|
|
2231
2746
|
loginStep,
|
|
2232
2747
|
{
|
|
2233
2748
|
name: 'Reject conflicting immutable tags',
|
|
2749
|
+
kind: 'check',
|
|
2234
2750
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2235
2751
|
run: checkImmutableTagsRun,
|
|
2236
2752
|
runBlock: true,
|
|
2237
2753
|
},
|
|
2238
2754
|
{
|
|
2239
2755
|
name: 'Push immutable OCI artifact',
|
|
2756
|
+
kind: 'deploy',
|
|
2240
2757
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2241
2758
|
run: pushRun,
|
|
2242
2759
|
runBlock: true,
|
|
2243
2760
|
},
|
|
2244
2761
|
{
|
|
2245
2762
|
name: 'Apply image tags',
|
|
2763
|
+
kind: 'deploy',
|
|
2246
2764
|
if: Runner.expr('env.PUBLISH == \'true\' && env.ADDITIONAL_TAGS != \'\''),
|
|
2247
2765
|
run: tagRun,
|
|
2248
2766
|
runBlock: true,
|
|
2249
2767
|
},
|
|
2250
2768
|
{
|
|
2251
2769
|
name: 'Verify immutable image tags',
|
|
2770
|
+
kind: 'check',
|
|
2252
2771
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2253
2772
|
run: verifyRun,
|
|
2254
2773
|
runBlock: true,
|
|
2255
2774
|
},
|
|
2256
2775
|
{
|
|
2257
2776
|
name: 'Generate build provenance',
|
|
2777
|
+
kind: 'attest',
|
|
2258
2778
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2259
2779
|
uses: getScaffoldVersion('workflowActionAttest'),
|
|
2260
2780
|
with: [
|
|
@@ -2272,8 +2792,10 @@ export class Runner {
|
|
|
2272
2792
|
},
|
|
2273
2793
|
],
|
|
2274
2794
|
},
|
|
2795
|
+
...postAttestationSteps,
|
|
2275
2796
|
{
|
|
2276
2797
|
name: 'Publish latest channel',
|
|
2798
|
+
kind: 'deploy',
|
|
2277
2799
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PUBLISH_LATEST == \'true\''),
|
|
2278
2800
|
run: 'oras tag "$IMAGE@$IMAGE_DIGEST" latest',
|
|
2279
2801
|
},
|
|
@@ -2448,6 +2970,32 @@ export class Runner {
|
|
|
2448
2970
|
'done',
|
|
2449
2971
|
].join('\n');
|
|
2450
2972
|
}
|
|
2973
|
+
static mergeContainerArtifactsRun() {
|
|
2974
|
+
return [
|
|
2975
|
+
'set -euo pipefail',
|
|
2976
|
+
'',
|
|
2977
|
+
'layout_directory="$RUNNER_TEMP/container-oci/layout"',
|
|
2978
|
+
'platform_tags=()',
|
|
2979
|
+
'',
|
|
2980
|
+
'mkdir -p "$RUNNER_TEMP/container-oci"',
|
|
2981
|
+
'',
|
|
2982
|
+
'for platform_directory in "$RUNNER_TEMP"/container-oci-platforms/*/; do',
|
|
2983
|
+
' platform_tag="$(basename "$platform_directory")"',
|
|
2984
|
+
' platform_digest="$(cat "$platform_directory"container-image.digest)"',
|
|
2985
|
+
'',
|
|
2986
|
+
' oras cp --from-oci-layout --to-oci-layout "$platform_directory"layout@"$platform_digest" "$layout_directory:$platform_tag"',
|
|
2987
|
+
' platform_tags+=("$platform_tag")',
|
|
2988
|
+
'done',
|
|
2989
|
+
'',
|
|
2990
|
+
`if [ "${'$'}{#platform_tags[@]}" -eq 0 ]; then`,
|
|
2991
|
+
' echo "No per-platform OCI artifacts were downloaded." >&2',
|
|
2992
|
+
' exit 1',
|
|
2993
|
+
'fi',
|
|
2994
|
+
'',
|
|
2995
|
+
`oras manifest index create --oci-layout "$layout_directory:nova-oci" "${'$'}{platform_tags[@]}"`,
|
|
2996
|
+
'printf \'%s\' "$(oras resolve --oci-layout "$layout_directory:nova-oci")" > "$RUNNER_TEMP/container-oci/container-image.digest"',
|
|
2997
|
+
].join('\n');
|
|
2998
|
+
}
|
|
2451
2999
|
static pushContainerArtifactRun() {
|
|
2452
3000
|
return 'oras cp --from-oci-layout "$RUNNER_TEMP/container-oci/layout@$(cat "$RUNNER_TEMP/container-oci/container-image.digest")" "$IMAGE:$SHA_TAG"';
|
|
2453
3001
|
}
|
|
@@ -2637,7 +3185,7 @@ export class Runner {
|
|
|
2637
3185
|
lines.push(`${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret list | jq -r '.[].name' | while read -r name; do`);
|
|
2638
3186
|
lines.push(' case " $DECLARED " in');
|
|
2639
3187
|
lines.push(' *" $name "*) ;;');
|
|
2640
|
-
lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name"
|
|
3188
|
+
lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name" < /dev/null ;;`);
|
|
2641
3189
|
lines.push(' esac');
|
|
2642
3190
|
lines.push('done');
|
|
2643
3191
|
lines.push('echo "Syncing declared secrets: $DECLARED"');
|
|
@@ -2681,6 +3229,7 @@ export class Runner {
|
|
|
2681
3229
|
const run = lines.join('\n');
|
|
2682
3230
|
return {
|
|
2683
3231
|
name: (vendor === 'cloudflare') ? 'Sync worker runtime secrets' : 'Sync Vercel runtime environment',
|
|
3232
|
+
kind: 'deploy',
|
|
2684
3233
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2685
3234
|
env,
|
|
2686
3235
|
run,
|
|
@@ -2916,7 +3465,7 @@ export class Runner {
|
|
|
2916
3465
|
}
|
|
2917
3466
|
return lines;
|
|
2918
3467
|
}
|
|
2919
|
-
static serializeJobs(jobs) {
|
|
3468
|
+
static serializeJobs(jobs, stepTimeoutMinutes) {
|
|
2920
3469
|
const lines = [];
|
|
2921
3470
|
lines.push('jobs:');
|
|
2922
3471
|
for (const job of jobs) {
|
|
@@ -2952,6 +3501,15 @@ export class Runner {
|
|
|
2952
3501
|
if (stepUses !== undefined) {
|
|
2953
3502
|
lines.push(` uses: ${Runner.quote(stepUses)}`);
|
|
2954
3503
|
}
|
|
3504
|
+
const configuredStepTimeoutMinutes = (stepTimeoutMinutes === undefined) ? undefined : stepTimeoutMinutes[step['kind']];
|
|
3505
|
+
const stepTimeoutDefault = libWorkflowStepTimeoutDefaults[step['kind']];
|
|
3506
|
+
const defaultStepTimeoutMinutes = (stepTimeoutDefault === 'job') ? job['timeoutMinutes'] : stepTimeoutDefault;
|
|
3507
|
+
const renderedStepTimeoutMinutes = Math.min(configuredStepTimeoutMinutes ?? defaultStepTimeoutMinutes, job['timeoutMinutes']);
|
|
3508
|
+
lines.push(` timeout-minutes: ${Runner.serializeScalar(renderedStepTimeoutMinutes)}`);
|
|
3509
|
+
const stepContinueOnError = step['continueOnError'];
|
|
3510
|
+
if (stepContinueOnError !== undefined) {
|
|
3511
|
+
lines.push(` continue-on-error: ${Runner.serializeScalar(stepContinueOnError)}`);
|
|
3512
|
+
}
|
|
2955
3513
|
const stepEnv = step['env'];
|
|
2956
3514
|
const isEnvAfterRun = step['envAfterRun'] === true;
|
|
2957
3515
|
if (stepEnv !== undefined && isEnvAfterRun === false) {
|