@cbnventures/nova 0.37.2 → 0.39.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 +20 -0
- 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/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 +226 -3
- 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 +804 -124
- 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 +13 -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/scaffold/app/astro.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/astro.js +8 -0
- package/build/src/cli/scaffold/app/astro.js.map +1 -1
- package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/discord-bot.js +28 -0
- package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
- package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/expressjs.js +28 -0
- package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
- package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/nextjs.js +22 -0
- package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
- package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/vite.js +8 -0
- package/build/src/cli/scaffold/app/vite.js.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.js +8 -0
- package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
- package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/github-action.js +14 -0
- package/build/src/cli/scaffold/package/github-action.js.map +1 -1
- package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/homebridge.js +22 -0
- package/build/src/cli/scaffold/package/homebridge.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 +148 -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 +86 -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 +802 -7
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/configure.d.ts +6 -1
- package/build/src/cli/utility/configure.d.ts.map +1 -1
- package/build/src/cli/utility/configure.js +278 -20
- package/build/src/cli/utility/configure.js.map +1 -1
- package/build/src/cli/utility/run-workspaces.d.ts.map +1 -1
- package/build/src/cli/utility/run-workspaces.js +1 -0
- package/build/src/cli/utility/run-workspaces.js.map +1 -1
- package/build/src/lib/artifact-assembly.d.ts +7 -0
- package/build/src/lib/artifact-assembly.d.ts.map +1 -0
- package/build/src/lib/artifact-assembly.js +122 -0
- package/build/src/lib/artifact-assembly.js.map +1 -0
- package/build/src/lib/docker-packaging.d.ts +3 -1
- package/build/src/lib/docker-packaging.d.ts.map +1 -1
- package/build/src/lib/docker-packaging.js +83 -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 +18 -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 +1 -0
- 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 +150 -4
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/regex.d.ts +14 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +14 -0
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/run-workspaces.d.ts.map +1 -1
- package/build/src/lib/run-workspaces.js +79 -8
- package/build/src/lib/run-workspaces.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 +140 -8
- package/build/src/lib/scaffold.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 +60 -2
- 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/github-runner-images.d.ts +199 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +76 -8
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +178 -11
- package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
- 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 +150 -4
- package/build/src/types/lib/artifact-assembly.d.ts +102 -0
- package/build/src/types/lib/docker-packaging.d.ts +54 -1
- package/build/src/types/lib/env-namespace.d.ts +4 -1
- package/build/src/types/lib/item.d.ts +7 -0
- package/build/src/types/lib/nova-config.d.ts +91 -2
- package/build/src/types/lib/regex.d.ts +91 -0
- package/build/src/types/lib/run-workspaces.d.ts +30 -0
- package/build/src/types/lib/scaffold.d.ts +67 -4
- package/build/src/types/lib/workflow-templates.d.ts +26 -0
- package/build/src/types/shared.d.ts +315 -3
- package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -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 +109 -26
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +146 -30
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +61 -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/scaffold/app/nextjs.test.d.ts +6 -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 +56 -0
- package/build/src/types/tests/cli/utility/run-workspaces.test.d.ts +29 -2
- package/build/src/types/tests/lib/artifact-assembly.test.d.ts +45 -0
- package/build/src/types/tests/lib/docker-packaging.test.d.ts +12 -0
- package/build/src/types/tests/lib/nova-config-artifacts.test.d.ts +40 -0
- package/build/src/types/tests/lib/nova-config.test.d.ts +28 -0
- package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +79 -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 +7 -1
- 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 +1 -1
- 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 +54 -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/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';
|
|
@@ -35,7 +37,10 @@ export class Runner {
|
|
|
35
37
|
}
|
|
36
38
|
const config = await new LibNovaConfig().load();
|
|
37
39
|
const workspaces = config['workspaces'] ?? {};
|
|
40
|
+
const artifacts = config['artifacts'] ?? {};
|
|
38
41
|
const environment = config['environment'] ?? {};
|
|
42
|
+
const projectDescription = (config['project'] !== undefined
|
|
43
|
+
&& config['project']['description'] !== undefined) ? config['project']['description']['short'] ?? '' : '';
|
|
39
44
|
const configPath = join(currentDirectory, 'nova.config.json');
|
|
40
45
|
let rawConfig = {};
|
|
41
46
|
try {
|
|
@@ -58,16 +63,34 @@ export class Runner {
|
|
|
58
63
|
}).info('No workflows configured.');
|
|
59
64
|
return 'completed';
|
|
60
65
|
}
|
|
61
|
-
const
|
|
66
|
+
const runnerImages = await GithubRunnerImages.fetchRunnerImages();
|
|
67
|
+
if (runnerImages === undefined) {
|
|
68
|
+
Logger.customize({
|
|
69
|
+
name: 'Runner.generate',
|
|
70
|
+
purpose: 'runners',
|
|
71
|
+
}).error(`Could not read GitHub's runner list from ${GITHUB_RUNNER_IMAGES_README_URL}.`);
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
return 'cancelled';
|
|
74
|
+
}
|
|
75
|
+
const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy'], environment, artifacts, projectDescription, runnerImages);
|
|
62
76
|
const validatedWorkflows = validation['workflows'];
|
|
77
|
+
const hasValidationErrors = validation['diagnostics'].some((diagnostic) => diagnostic['severity'] === 'error');
|
|
63
78
|
for (const diagnosticEntry of validation['diagnostics']) {
|
|
64
79
|
const diagnostic = diagnosticEntry;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
if (diagnostic['severity'] === 'warning') {
|
|
81
|
+
Logger.customize({
|
|
82
|
+
name: 'Runner.generate',
|
|
83
|
+
purpose: 'validate',
|
|
84
|
+
}).warn(diagnostic['message']);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
Logger.customize({
|
|
88
|
+
name: 'Runner.generate',
|
|
89
|
+
purpose: 'validate',
|
|
90
|
+
}).error(diagnostic['message']);
|
|
91
|
+
}
|
|
69
92
|
}
|
|
70
|
-
if (
|
|
93
|
+
if (hasValidationErrors === true) {
|
|
71
94
|
process.exitCode = 1;
|
|
72
95
|
}
|
|
73
96
|
const hasPublishWorkflow = validatedWorkflows.some((workflow) => workflow['template'] === 'publish');
|
|
@@ -106,7 +129,7 @@ export class Runner {
|
|
|
106
129
|
const template = entry['template'];
|
|
107
130
|
const suffix = entry['name'];
|
|
108
131
|
const outputFileName = (suffix !== undefined) ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
|
|
109
|
-
const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager);
|
|
132
|
+
const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts, projectDescription);
|
|
110
133
|
const entrySetupLines = Variables.collectSetupLines(entry, outputFileName, environment);
|
|
111
134
|
generatedSet.add(outputFileName);
|
|
112
135
|
setupLines.push(...entrySetupLines);
|
|
@@ -121,7 +144,7 @@ export class Runner {
|
|
|
121
144
|
await saveGeneratedFile(targetPath, serialized, isReplaceFile);
|
|
122
145
|
}
|
|
123
146
|
if (isDryRun !== true
|
|
124
|
-
&&
|
|
147
|
+
&& hasValidationErrors === false
|
|
125
148
|
&& await pathExists(workflowsDirectory) === true) {
|
|
126
149
|
let existingEntries = [];
|
|
127
150
|
try {
|
|
@@ -171,7 +194,7 @@ export class Runner {
|
|
|
171
194
|
}
|
|
172
195
|
return 'completed';
|
|
173
196
|
}
|
|
174
|
-
static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm') {
|
|
197
|
+
static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, projectDescription = '') {
|
|
175
198
|
const template = entry['template'];
|
|
176
199
|
let workflow = undefined;
|
|
177
200
|
if (template === 'check-sponsor-gated-issues') {
|
|
@@ -181,17 +204,21 @@ export class Runner {
|
|
|
181
204
|
workflow = Runner.buildLockInactiveIssues(entry, environment);
|
|
182
205
|
}
|
|
183
206
|
else {
|
|
184
|
-
workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager);
|
|
207
|
+
workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts, projectDescription);
|
|
185
208
|
}
|
|
186
209
|
const runsOn = entry['runsOn'];
|
|
187
|
-
const timeoutMinutes = entry['timeoutMinutes'];
|
|
188
210
|
for (const jobEntry of workflow['jobs']) {
|
|
189
211
|
const job = jobEntry;
|
|
190
212
|
if (runsOn !== undefined) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
213
|
+
const runnerArchitecture = job['runnerArchitecture'];
|
|
214
|
+
let jobRunsOn = runsOn;
|
|
215
|
+
if (runnerArchitecture === 'arm64' && runsOn.endsWith('-arm') === false) {
|
|
216
|
+
jobRunsOn = `${runsOn}-arm`;
|
|
217
|
+
}
|
|
218
|
+
else if (runnerArchitecture === 'x64' && runsOn.endsWith('-arm') === true) {
|
|
219
|
+
jobRunsOn = runsOn.slice(0, -4);
|
|
220
|
+
}
|
|
221
|
+
Reflect.set(job, 'runsOn', jobRunsOn);
|
|
195
222
|
}
|
|
196
223
|
}
|
|
197
224
|
return Runner.serialize(workflow);
|
|
@@ -215,7 +242,7 @@ export class Runner {
|
|
|
215
242
|
lines.push('');
|
|
216
243
|
lines.push(...Runner.serializeEnv(workflow['env']));
|
|
217
244
|
lines.push('');
|
|
218
|
-
lines.push(...Runner.serializeJobs(workflow['jobs']));
|
|
245
|
+
lines.push(...Runner.serializeJobs(workflow['jobs'], workflow['stepTimeoutMinutes']));
|
|
219
246
|
return `${lines.join('\n')}\n`;
|
|
220
247
|
}
|
|
221
248
|
static buildCheckSponsorGatedIssues(entry, environment = {}) {
|
|
@@ -276,6 +303,7 @@ export class Runner {
|
|
|
276
303
|
];
|
|
277
304
|
const step = {
|
|
278
305
|
name: 'Check support issues',
|
|
306
|
+
kind: 'deploy',
|
|
279
307
|
uses: getScaffoldVersion('workflowActionSponsorGatedSupport'),
|
|
280
308
|
env: [
|
|
281
309
|
{
|
|
@@ -337,7 +365,7 @@ export class Runner {
|
|
|
337
365
|
const job = {
|
|
338
366
|
id: 'check-issues',
|
|
339
367
|
runsOn: 'ubuntu-latest',
|
|
340
|
-
timeoutMinutes: 5,
|
|
368
|
+
timeoutMinutes: entry['timeoutMinutes'] ?? 5,
|
|
341
369
|
permissions: {
|
|
342
370
|
contents: 'read',
|
|
343
371
|
issues: 'write',
|
|
@@ -345,6 +373,7 @@ export class Runner {
|
|
|
345
373
|
steps: [
|
|
346
374
|
{
|
|
347
375
|
name: 'Checkout repository',
|
|
376
|
+
kind: 'checkout',
|
|
348
377
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
349
378
|
},
|
|
350
379
|
step,
|
|
@@ -362,6 +391,7 @@ export class Runner {
|
|
|
362
391
|
cancelInProgress: false,
|
|
363
392
|
},
|
|
364
393
|
env,
|
|
394
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
365
395
|
jobs: [job],
|
|
366
396
|
};
|
|
367
397
|
}
|
|
@@ -403,6 +433,7 @@ export class Runner {
|
|
|
403
433
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
404
434
|
const step = {
|
|
405
435
|
name: 'Lock inactive threads',
|
|
436
|
+
kind: 'deploy',
|
|
406
437
|
uses: getScaffoldVersion('workflowActionLockInactiveThreads'),
|
|
407
438
|
env: [{
|
|
408
439
|
key: 'GITHUB_TOKEN',
|
|
@@ -450,7 +481,7 @@ export class Runner {
|
|
|
450
481
|
const job = {
|
|
451
482
|
id: 'lock-inactive-issues',
|
|
452
483
|
runsOn: 'ubuntu-latest',
|
|
453
|
-
timeoutMinutes: 5,
|
|
484
|
+
timeoutMinutes: entry['timeoutMinutes'] ?? 5,
|
|
454
485
|
steps: [step],
|
|
455
486
|
};
|
|
456
487
|
return {
|
|
@@ -466,10 +497,11 @@ export class Runner {
|
|
|
466
497
|
cancelInProgress: false,
|
|
467
498
|
},
|
|
468
499
|
env,
|
|
500
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
469
501
|
jobs: [job],
|
|
470
502
|
};
|
|
471
503
|
}
|
|
472
|
-
static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm') {
|
|
504
|
+
static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, projectDescription = '') {
|
|
473
505
|
const suffix = entry['name'];
|
|
474
506
|
const workflowId = Runner.resolveWorkflowId(suffix);
|
|
475
507
|
const on = [];
|
|
@@ -481,6 +513,7 @@ export class Runner {
|
|
|
481
513
|
const profileAware = environmentSelection !== undefined;
|
|
482
514
|
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\'';
|
|
483
515
|
const hasContainerTarget = targets.some((target) => target['to'] === 'docker-hub' || target['to'] === 'ghcr');
|
|
516
|
+
const hasPfsenseTarget = targets.some((target) => target['to'] === 'pfsense');
|
|
484
517
|
const containerPlatforms = entry['containerPlatforms'] ?? [
|
|
485
518
|
'linux/amd64',
|
|
486
519
|
'linux/arm64',
|
|
@@ -589,7 +622,16 @@ export class Runner {
|
|
|
589
622
|
type: 'boolean',
|
|
590
623
|
default: true,
|
|
591
624
|
}];
|
|
592
|
-
if (
|
|
625
|
+
if (hasPfsenseTarget === true) {
|
|
626
|
+
dispatchInputs.push({
|
|
627
|
+
name: 'tag',
|
|
628
|
+
description: (hasContainerTarget === true) ? 'Existing GitHub release tag and image tag used when manually publishing' : 'Existing GitHub release tag that receives the package',
|
|
629
|
+
required: true,
|
|
630
|
+
type: 'string',
|
|
631
|
+
default: '',
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
else if (hasContainerTarget === true) {
|
|
593
635
|
dispatchInputs.push({
|
|
594
636
|
name: 'tag',
|
|
595
637
|
description: 'Required image tag when manually publishing',
|
|
@@ -642,15 +684,32 @@ export class Runner {
|
|
|
642
684
|
},
|
|
643
685
|
];
|
|
644
686
|
const scopes = entry['build'] ?? [];
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
687
|
+
const artifactNames = [...new Set(targets.flatMap((target) => (target['artifact'] === undefined) ? [] : [target['artifact']]))];
|
|
688
|
+
const artifactWorkspaceNames = [];
|
|
689
|
+
for (const artifactName of artifactNames) {
|
|
690
|
+
const artifact = artifacts[artifactName];
|
|
691
|
+
if (artifact === undefined) {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
for (const artifactScopeValue of artifact['build']) {
|
|
695
|
+
const artifactScope = artifactScopeValue;
|
|
696
|
+
const artifactWorkspace = workspaces[artifactScope];
|
|
697
|
+
artifactWorkspaceNames.push(artifactWorkspace['name']);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const names = [...new Set([
|
|
701
|
+
...artifactWorkspaceNames,
|
|
702
|
+
...scopes.map((scope) => {
|
|
703
|
+
const scopeWorkspace = workspaces[scope];
|
|
704
|
+
return scopeWorkspace['name'];
|
|
705
|
+
}),
|
|
706
|
+
])];
|
|
707
|
+
const checkCommand = Runner.buildScopeCommand('check', names, [], packageManager);
|
|
708
|
+
const buildCommand = Runner.buildScopeCommand('build', names, artifactNames, packageManager);
|
|
651
709
|
const steps = [
|
|
652
710
|
{
|
|
653
711
|
name: 'Checkout repository',
|
|
712
|
+
kind: 'checkout',
|
|
654
713
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
655
714
|
with: [
|
|
656
715
|
{
|
|
@@ -665,6 +724,7 @@ export class Runner {
|
|
|
665
724
|
},
|
|
666
725
|
{
|
|
667
726
|
name: 'Setup Node.js',
|
|
727
|
+
kind: 'setup',
|
|
668
728
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
669
729
|
with: [
|
|
670
730
|
{
|
|
@@ -679,6 +739,7 @@ export class Runner {
|
|
|
679
739
|
},
|
|
680
740
|
{
|
|
681
741
|
name: 'Install packages',
|
|
742
|
+
kind: 'install',
|
|
682
743
|
run: Runner.installPackagesRun(packageManager),
|
|
683
744
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
684
745
|
},
|
|
@@ -698,6 +759,7 @@ export class Runner {
|
|
|
698
759
|
}
|
|
699
760
|
const writeEnvStep = {
|
|
700
761
|
name: `Write environment file (${Runner.slugifyWorkingDir(scope)})`,
|
|
762
|
+
kind: 'setup',
|
|
701
763
|
env: buildValues.map((buildValue) => ({
|
|
702
764
|
key: buildValue['key'],
|
|
703
765
|
value: Runner.resolveDeliveryValueExpr(buildValue),
|
|
@@ -710,6 +772,7 @@ export class Runner {
|
|
|
710
772
|
}
|
|
711
773
|
steps.push({
|
|
712
774
|
name: 'Check project',
|
|
775
|
+
kind: 'check',
|
|
713
776
|
run: checkCommand,
|
|
714
777
|
runBlock: true,
|
|
715
778
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
@@ -717,6 +780,7 @@ export class Runner {
|
|
|
717
780
|
if (names.length > 0) {
|
|
718
781
|
steps.push({
|
|
719
782
|
name: 'Build project',
|
|
783
|
+
kind: 'build',
|
|
720
784
|
run: buildCommand,
|
|
721
785
|
runBlock: true,
|
|
722
786
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
@@ -725,6 +789,7 @@ export class Runner {
|
|
|
725
789
|
if (hasContainerTarget === true) {
|
|
726
790
|
steps.push({
|
|
727
791
|
name: 'Validate manual container tag',
|
|
792
|
+
kind: 'check',
|
|
728
793
|
if: Runner.expr('github.event_name == \'workflow_dispatch\' && !inputs.dry-run'),
|
|
729
794
|
env: [{
|
|
730
795
|
key: 'MANUAL_TAG',
|
|
@@ -741,24 +806,36 @@ export class Runner {
|
|
|
741
806
|
}
|
|
742
807
|
const artifactPreflightPaths = [];
|
|
743
808
|
const artifactUploadSteps = [];
|
|
809
|
+
const seenArtifactNames = new Set();
|
|
744
810
|
for (const target of targets) {
|
|
745
811
|
const uploadTarget = target;
|
|
812
|
+
const uploadConfiguredArtifactName = uploadTarget['artifact'];
|
|
813
|
+
if (uploadConfiguredArtifactName !== undefined && seenArtifactNames.has(uploadConfiguredArtifactName) === true) {
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
746
816
|
const uploadMetadata = Variables.getTargetMetadata('publish', uploadTarget['to']);
|
|
747
|
-
|
|
817
|
+
let uploadArtifactPaths = [`build/${uploadConfiguredArtifactName}`];
|
|
818
|
+
if (uploadConfiguredArtifactName === undefined) {
|
|
819
|
+
uploadArtifactPaths = ['{workingDir}/build'];
|
|
820
|
+
if (uploadMetadata !== undefined) {
|
|
821
|
+
uploadArtifactPaths = uploadMetadata['artifactPaths'];
|
|
822
|
+
}
|
|
823
|
+
}
|
|
748
824
|
if (uploadArtifactPaths.length === 0) {
|
|
749
825
|
continue;
|
|
750
826
|
}
|
|
751
827
|
const uploadWorkingDir = (uploadTarget['path'] === './') ? '.' : uploadTarget['path'].replace(LIB_REGEX_PATTERN_LEADING_DOT_SLASH, '');
|
|
752
828
|
const uploadResolvedArtifactPaths = uploadArtifactPaths.map((artifactPath) => artifactPath.replace('{workingDir}', uploadWorkingDir));
|
|
753
829
|
const uploadPath = uploadResolvedArtifactPaths.join('\n');
|
|
754
|
-
const
|
|
830
|
+
const uploadArtifactName = (uploadConfiguredArtifactName === undefined) ? `build-${uploadTarget['to']}-${Runner.slugifyWorkingDir(uploadTarget['path'])}` : `artifact-${uploadConfiguredArtifactName}`;
|
|
755
831
|
const uploadStep = {
|
|
756
|
-
name: `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})`,
|
|
832
|
+
name: (uploadConfiguredArtifactName === undefined) ? `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})` : `Upload assembled artifact (${uploadConfiguredArtifactName})`,
|
|
833
|
+
kind: 'artifact',
|
|
757
834
|
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
758
835
|
with: [
|
|
759
836
|
{
|
|
760
837
|
key: 'name',
|
|
761
|
-
value:
|
|
838
|
+
value: uploadArtifactName,
|
|
762
839
|
},
|
|
763
840
|
{
|
|
764
841
|
key: 'retention-days',
|
|
@@ -785,37 +862,58 @@ export class Runner {
|
|
|
785
862
|
}
|
|
786
863
|
}
|
|
787
864
|
artifactUploadSteps.push(uploadStep);
|
|
865
|
+
if (uploadConfiguredArtifactName !== undefined) {
|
|
866
|
+
seenArtifactNames.add(uploadConfiguredArtifactName);
|
|
867
|
+
}
|
|
788
868
|
}
|
|
789
869
|
if (artifactPreflightPaths.length > 0) {
|
|
790
870
|
steps.push(Runner.buildArtifactPreflightStep('Validate build artifacts', artifactPreflightPaths, Runner.expr('github.workspace')), ...artifactUploadSteps);
|
|
791
871
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
steps.push(...containerArtifactSteps);
|
|
795
|
-
}
|
|
872
|
+
const configuredTimeoutMinutes = entry['timeoutMinutes'];
|
|
873
|
+
const configuredBuildTimeoutMinutes = entry['buildTimeoutMinutes'];
|
|
796
874
|
const buildJob = {
|
|
797
875
|
id: 'build',
|
|
798
876
|
runsOn: 'ubuntu-latest',
|
|
799
|
-
timeoutMinutes:
|
|
877
|
+
timeoutMinutes: configuredBuildTimeoutMinutes
|
|
878
|
+
?? configuredTimeoutMinutes
|
|
879
|
+
?? 15,
|
|
800
880
|
permissions: {
|
|
801
881
|
contents: 'read',
|
|
802
882
|
},
|
|
803
883
|
steps,
|
|
804
884
|
};
|
|
805
885
|
const jobs = [buildJob];
|
|
886
|
+
if (hasContainerTarget === true) {
|
|
887
|
+
const containerJobs = Runner.buildContainerJobs(containerPlatforms, buildJob['timeoutMinutes'], (hasWorkflowRunNode === true) ? Runner.expr('github.event.workflow_run.head_sha') : undefined);
|
|
888
|
+
jobs.push(...containerJobs);
|
|
889
|
+
}
|
|
806
890
|
for (const target of targets) {
|
|
807
891
|
const deployTarget = target;
|
|
808
892
|
const targetSettings = deployTarget['with'];
|
|
809
893
|
const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
|
|
894
|
+
const deployConfiguredArtifactName = deployTarget['artifact'];
|
|
895
|
+
const deployTimeoutMinutes = deployTarget['timeoutMinutes']
|
|
896
|
+
?? configuredTimeoutMinutes
|
|
897
|
+
?? 15;
|
|
898
|
+
let deployArtifactName = `artifact-${deployConfiguredArtifactName}`;
|
|
899
|
+
if (isContainerTarget === true) {
|
|
900
|
+
deployArtifactName = 'container-oci';
|
|
901
|
+
}
|
|
902
|
+
else if (deployConfiguredArtifactName === undefined) {
|
|
903
|
+
deployArtifactName = `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`;
|
|
904
|
+
}
|
|
810
905
|
const context = {
|
|
811
906
|
workingDir: deployTarget['path'],
|
|
812
|
-
artifactName:
|
|
813
|
-
|
|
907
|
+
artifactName: deployArtifactName,
|
|
908
|
+
...((deployConfiguredArtifactName === undefined) ? {} : { artifactDirectory: `build/${deployConfiguredArtifactName}` }),
|
|
909
|
+
needs: (isContainerTarget === true) ? ['build-container'] : Runner.resolveDeployNeeds(deployTarget),
|
|
814
910
|
targetSettings,
|
|
815
911
|
workflowSettings,
|
|
816
912
|
workspace: workspaces[deployTarget['path']],
|
|
817
913
|
environment,
|
|
818
914
|
packageManager,
|
|
915
|
+
timeoutMinutes: deployTimeoutMinutes,
|
|
916
|
+
projectDescription,
|
|
819
917
|
...((environmentSelection === undefined) ? {} : { environmentSelection }),
|
|
820
918
|
};
|
|
821
919
|
if (deployTarget['to'] === 'npm') {
|
|
@@ -842,16 +940,13 @@ export class Runner {
|
|
|
842
940
|
else if (deployTarget['to'] === 'github-action') {
|
|
843
941
|
jobs.push(Runner.buildGithubActionTarget(context));
|
|
844
942
|
}
|
|
943
|
+
else if (deployTarget['to'] === 'pfsense') {
|
|
944
|
+
jobs.push(Runner.buildPfsenseTarget(context));
|
|
945
|
+
}
|
|
845
946
|
else if (deployTarget['to'] === 'vercel-nextjs') {
|
|
846
947
|
jobs.push(Runner.buildVercelNextjsTarget(context));
|
|
847
948
|
}
|
|
848
949
|
}
|
|
849
|
-
const configuredTimeoutMinutes = entry['timeoutMinutes'];
|
|
850
|
-
if (configuredTimeoutMinutes !== undefined) {
|
|
851
|
-
for (const configuredJob of jobs) {
|
|
852
|
-
configuredJob.timeoutMinutes = configuredTimeoutMinutes;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
950
|
if (jobsCondition !== undefined) {
|
|
856
951
|
for (const gatedJob of jobs) {
|
|
857
952
|
Reflect.set(gatedJob, 'if', jobsCondition);
|
|
@@ -869,6 +964,7 @@ export class Runner {
|
|
|
869
964
|
cancelInProgress: false,
|
|
870
965
|
},
|
|
871
966
|
env,
|
|
967
|
+
...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
|
|
872
968
|
jobs,
|
|
873
969
|
};
|
|
874
970
|
}
|
|
@@ -912,6 +1008,7 @@ export class Runner {
|
|
|
912
1008
|
];
|
|
913
1009
|
return {
|
|
914
1010
|
name: 'Select Cloudflare deployment environment',
|
|
1011
|
+
kind: 'setup',
|
|
915
1012
|
env: [
|
|
916
1013
|
{
|
|
917
1014
|
key: 'MANUAL_ENVIRONMENT',
|
|
@@ -1029,6 +1126,7 @@ export class Runner {
|
|
|
1029
1126
|
}
|
|
1030
1127
|
return {
|
|
1031
1128
|
name: 'Validate Cloudflare deployment environment',
|
|
1129
|
+
kind: 'check',
|
|
1032
1130
|
env,
|
|
1033
1131
|
run: lines.join('\n'),
|
|
1034
1132
|
runBlock: true,
|
|
@@ -1073,11 +1171,12 @@ export class Runner {
|
|
|
1073
1171
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1074
1172
|
const environment = context['environment'];
|
|
1075
1173
|
const appPath = context['workingDir'];
|
|
1174
|
+
const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
|
|
1076
1175
|
return {
|
|
1077
1176
|
id: `publish-npm-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1078
1177
|
needs: context['needs'],
|
|
1079
1178
|
runsOn: 'ubuntu-latest',
|
|
1080
|
-
timeoutMinutes:
|
|
1179
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1081
1180
|
permissions: {
|
|
1082
1181
|
'contents': 'read',
|
|
1083
1182
|
'id-token': 'write',
|
|
@@ -1085,10 +1184,12 @@ export class Runner {
|
|
|
1085
1184
|
steps: [
|
|
1086
1185
|
{
|
|
1087
1186
|
name: 'Checkout repository',
|
|
1187
|
+
kind: 'checkout',
|
|
1088
1188
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1089
1189
|
},
|
|
1090
1190
|
{
|
|
1091
1191
|
name: 'Setup Node.js',
|
|
1192
|
+
kind: 'setup',
|
|
1092
1193
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1093
1194
|
with: [
|
|
1094
1195
|
{
|
|
@@ -1107,10 +1208,12 @@ export class Runner {
|
|
|
1107
1208
|
},
|
|
1108
1209
|
{
|
|
1109
1210
|
name: 'Remove deprecated .npmrc entries',
|
|
1211
|
+
kind: 'setup',
|
|
1110
1212
|
run: Runner.removeDeprecatedNpmrcRun(),
|
|
1111
1213
|
},
|
|
1112
1214
|
{
|
|
1113
1215
|
name: 'Download build artifacts',
|
|
1216
|
+
kind: 'artifact',
|
|
1114
1217
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1115
1218
|
with: [
|
|
1116
1219
|
{
|
|
@@ -1119,12 +1222,13 @@ export class Runner {
|
|
|
1119
1222
|
},
|
|
1120
1223
|
{
|
|
1121
1224
|
key: 'path',
|
|
1122
|
-
value: `${context['workingDir']}/build`,
|
|
1225
|
+
value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
|
|
1123
1226
|
},
|
|
1124
1227
|
],
|
|
1125
1228
|
},
|
|
1126
1229
|
{
|
|
1127
1230
|
name: 'Configure authentication',
|
|
1231
|
+
kind: 'registry',
|
|
1128
1232
|
env: [{
|
|
1129
1233
|
key: 'NPM_TOKEN',
|
|
1130
1234
|
value: Runner.resolveScopedCredExpr(variables, 'NPM_TOKEN', targetSettings, workflowSettings, environment, appPath),
|
|
@@ -1133,8 +1237,286 @@ export class Runner {
|
|
|
1133
1237
|
},
|
|
1134
1238
|
{
|
|
1135
1239
|
name: 'Publish package to npm',
|
|
1240
|
+
kind: 'deploy',
|
|
1136
1241
|
run: Runner.npmPublishRun(),
|
|
1137
|
-
workingDirectory:
|
|
1242
|
+
workingDirectory: deployDirectory,
|
|
1243
|
+
},
|
|
1244
|
+
],
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
static buildPfsenseTarget(context) {
|
|
1248
|
+
const targetSettings = context['targetSettings'];
|
|
1249
|
+
const workflowSettings = context['workflowSettings'];
|
|
1250
|
+
const metadata = Variables.getTargetMetadata('publish', 'pfsense');
|
|
1251
|
+
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1252
|
+
const environment = context['environment'];
|
|
1253
|
+
const appPath = context['workingDir'];
|
|
1254
|
+
const workspaceName = basename(context['workingDir']);
|
|
1255
|
+
const validateAndStageRun = [
|
|
1256
|
+
`node "${context['workingDir']}/scripts/check-package.mjs"`,
|
|
1257
|
+
`node "${context['workingDir']}/scripts/stage-package.mjs"`,
|
|
1258
|
+
].join('\n');
|
|
1259
|
+
const dollar = Runner.dollar();
|
|
1260
|
+
const escapedNewline = [
|
|
1261
|
+
'\\',
|
|
1262
|
+
'n',
|
|
1263
|
+
].join('');
|
|
1264
|
+
const stagedShareDirectory = `${context['workingDir']}/build/port/files/usr/local/share`;
|
|
1265
|
+
const releaseDirectory = `${context['workingDir']}/build/release`;
|
|
1266
|
+
const addSigningKeyRun = [
|
|
1267
|
+
'set -eu',
|
|
1268
|
+
'',
|
|
1269
|
+
`staged_share_directory="${stagedShareDirectory}"`,
|
|
1270
|
+
'',
|
|
1271
|
+
`if [ -z "${dollar}RELEASE_SIGNING_KEY:-}" ]; then`,
|
|
1272
|
+
' echo "::notice::The release signing secret is not set, so the package ships without a release signing key."',
|
|
1273
|
+
' exit 0',
|
|
1274
|
+
'fi',
|
|
1275
|
+
'',
|
|
1276
|
+
'umask 077',
|
|
1277
|
+
`key_directory="$(mktemp -d "${dollar}RUNNER_TEMP:-/tmp}/release-signing.XXXXXX")"`,
|
|
1278
|
+
'trap \'rm -rf "$key_directory"\' EXIT',
|
|
1279
|
+
`printf '%s${escapedNewline}' "$RELEASE_SIGNING_KEY" | tr -d '\\r' > "${dollar}key_directory}/signing-key"`,
|
|
1280
|
+
'',
|
|
1281
|
+
`if ! ssh-keygen -y -P '' -f "${dollar}key_directory}/signing-key" > "${dollar}key_directory}/signing-key.pub" 2> /dev/null; then`,
|
|
1282
|
+
' echo "::error::The release signing secret must be an unencrypted OpenSSH private key that starts with \\"-----BEGIN OPENSSH PRIVATE KEY-----\\"."',
|
|
1283
|
+
' exit 1',
|
|
1284
|
+
'fi',
|
|
1285
|
+
'',
|
|
1286
|
+
`public_key="$(awk '{ print $1 " " $2 }' "${dollar}key_directory}/signing-key.pub")"`,
|
|
1287
|
+
'',
|
|
1288
|
+
'case "$public_key" in',
|
|
1289
|
+
' "ssh-ed25519 "*)',
|
|
1290
|
+
' ;;',
|
|
1291
|
+
' *)',
|
|
1292
|
+
' echo "::error::The release signing secret must be an Ed25519 key."',
|
|
1293
|
+
' exit 1',
|
|
1294
|
+
' ;;',
|
|
1295
|
+
'esac',
|
|
1296
|
+
'',
|
|
1297
|
+
'key_file_count=0',
|
|
1298
|
+
'',
|
|
1299
|
+
`for public_key_file in "${dollar}staged_share_directory}"/*/release-signing.pub; do`,
|
|
1300
|
+
' if [ ! -f "$public_key_file" ]; then',
|
|
1301
|
+
' continue',
|
|
1302
|
+
' fi',
|
|
1303
|
+
'',
|
|
1304
|
+
' key_file_count=$((key_file_count + 1))',
|
|
1305
|
+
'',
|
|
1306
|
+
' if [ -s "$public_key_file" ] && [ -n "$(tail -c 1 "$public_key_file")" ]; then',
|
|
1307
|
+
` printf '${escapedNewline}' >> "$public_key_file"`,
|
|
1308
|
+
' fi',
|
|
1309
|
+
'',
|
|
1310
|
+
' if ! tr -d \'\\r\' < "$public_key_file" | awk \'{ print $1 " " $2 }\' | grep -Fxq "$public_key"; then',
|
|
1311
|
+
` printf '%s added by the publish workflow${escapedNewline}' "$public_key" >> "$public_key_file"`,
|
|
1312
|
+
' fi',
|
|
1313
|
+
'done',
|
|
1314
|
+
'',
|
|
1315
|
+
'if [ "$key_file_count" -eq 0 ]; then',
|
|
1316
|
+
' echo "::warning::The staged port has no usr/local/share/<package>/release-signing.pub file, so installed copies won\'t check release signatures."',
|
|
1317
|
+
'fi',
|
|
1318
|
+
'',
|
|
1319
|
+
].join('\n');
|
|
1320
|
+
const freebsdRun = [
|
|
1321
|
+
'git clone --depth 1 --single-branch --branch devel --filter=blob:none --sparse https://github.com/pfsense/FreeBSD-ports.git /usr/ports',
|
|
1322
|
+
'git -C /usr/ports sparse-checkout set Mk Templates Keywords',
|
|
1323
|
+
`PFSENSE_PORTS_DIR=/usr/ports sh "${context['workingDir']}/scripts/build-package.sh"`,
|
|
1324
|
+
].join('\n');
|
|
1325
|
+
const signReleaseRun = [
|
|
1326
|
+
'set -eu',
|
|
1327
|
+
'',
|
|
1328
|
+
`release_directory="${releaseDirectory}"`,
|
|
1329
|
+
`share_directory="${stagedShareDirectory}"`,
|
|
1330
|
+
'',
|
|
1331
|
+
'# Prints the key lines of a release-signing.pub file. Blank lines and "#"',
|
|
1332
|
+
'# comments are skipped, the same way the installed package reads the file.',
|
|
1333
|
+
'read_key_lines() {',
|
|
1334
|
+
' tr -d \'\\r\' < "$1" | sed -e \'s/^[[:space:]]*//\' -e \'s/[[:space:]]*$//\' | grep -v -e \'^$\' -e \'^#\' || true',
|
|
1335
|
+
'}',
|
|
1336
|
+
'',
|
|
1337
|
+
'package_count=0',
|
|
1338
|
+
'',
|
|
1339
|
+
`for package_file in "${dollar}release_directory}"/*.pkg; do`,
|
|
1340
|
+
' if [ -f "$package_file" ]; then',
|
|
1341
|
+
' package_count=$((package_count + 1))',
|
|
1342
|
+
' fi',
|
|
1343
|
+
'done',
|
|
1344
|
+
'',
|
|
1345
|
+
'if [ "$package_count" -eq 0 ]; then',
|
|
1346
|
+
` echo "::error::No .pkg files were found in ${dollar}release_directory}."`,
|
|
1347
|
+
' exit 1',
|
|
1348
|
+
'fi',
|
|
1349
|
+
'',
|
|
1350
|
+
`if [ -z "${dollar}RELEASE_SIGNING_KEY:-}" ]; then`,
|
|
1351
|
+
' echo "::notice::The release signing secret is not set, so the release packages are not signed."',
|
|
1352
|
+
' exit 0',
|
|
1353
|
+
'fi',
|
|
1354
|
+
'',
|
|
1355
|
+
'umask 077',
|
|
1356
|
+
`key_directory="$(mktemp -d "${dollar}RUNNER_TEMP:-/tmp}/release-signing.XXXXXX")"`,
|
|
1357
|
+
'trap \'rm -rf "$key_directory"\' EXIT',
|
|
1358
|
+
`printf '%s${escapedNewline}' "$RELEASE_SIGNING_KEY" | tr -d '\\r' > "${dollar}key_directory}/signing-key"`,
|
|
1359
|
+
'',
|
|
1360
|
+
`if ! ssh-keygen -y -P '' -f "${dollar}key_directory}/signing-key" > "${dollar}key_directory}/signing-key.pub" 2> /dev/null; then`,
|
|
1361
|
+
' echo "::error::The release signing secret must be an unencrypted OpenSSH private key that starts with \\"-----BEGIN OPENSSH PRIVATE KEY-----\\"."',
|
|
1362
|
+
' exit 1',
|
|
1363
|
+
'fi',
|
|
1364
|
+
'',
|
|
1365
|
+
`for package_file in "${dollar}release_directory}"/*.pkg; do`,
|
|
1366
|
+
' package_name="$(basename "$package_file" .pkg)"',
|
|
1367
|
+
'',
|
|
1368
|
+
' # Versioned files end in -<version>; a stable copy such as pfSense-pkg-Demo.pkg',
|
|
1369
|
+
' # already is the package name, so only a suffix that starts with a digit is removed.',
|
|
1370
|
+
` case "${dollar}package_name##*-}" in`,
|
|
1371
|
+
` [0-9]*) package_name="${dollar}package_name%-*}" ;;`,
|
|
1372
|
+
' esac',
|
|
1373
|
+
'',
|
|
1374
|
+
` public_key_file="${dollar}share_directory}/${dollar}package_name}/release-signing.pub"`,
|
|
1375
|
+
'',
|
|
1376
|
+
` rm -f "${dollar}package_file}.sig"`,
|
|
1377
|
+
` ssh-keygen -Y sign -f "${dollar}key_directory}/signing-key" -n "$package_name" "$package_file"`,
|
|
1378
|
+
'',
|
|
1379
|
+
' key_lines=""',
|
|
1380
|
+
'',
|
|
1381
|
+
' if [ -f "$public_key_file" ]; then',
|
|
1382
|
+
' key_lines="$(read_key_lines "$public_key_file")"',
|
|
1383
|
+
' fi',
|
|
1384
|
+
'',
|
|
1385
|
+
' if [ -z "$key_lines" ]; then',
|
|
1386
|
+
` echo "::warning::${dollar}package_name} lists no key in release-signing.pub, so installed copies won't check this signature."`,
|
|
1387
|
+
' continue',
|
|
1388
|
+
' fi',
|
|
1389
|
+
'',
|
|
1390
|
+
` : > "${dollar}key_directory}/allowed_signers"`,
|
|
1391
|
+
'',
|
|
1392
|
+
' while IFS= read -r key_line; do',
|
|
1393
|
+
` if ! printf '%s${escapedNewline}' "$key_line" | grep -Eq '^ssh-ed25519[[:space:]]+AAAAC3NzaC1lZDI1NTE5AAAAI[A-Za-z0-9+/]{43}([[:space:]].*)?$'; then`,
|
|
1394
|
+
` echo "::error::${dollar}public_key_file} has a line that isn't an \\"ssh-ed25519\\" public key."`,
|
|
1395
|
+
' exit 1',
|
|
1396
|
+
' fi',
|
|
1397
|
+
'',
|
|
1398
|
+
` key_data="$(printf '%s${escapedNewline}' "$key_line" | awk '{ print $2 }')"`,
|
|
1399
|
+
` printf '%s namespaces="%s" ssh-ed25519 %s${escapedNewline}' "$package_name" "$package_name" "$key_data" >> "${dollar}key_directory}/allowed_signers"`,
|
|
1400
|
+
' done <<KEY_LINES',
|
|
1401
|
+
`${dollar}key_lines}`,
|
|
1402
|
+
'KEY_LINES',
|
|
1403
|
+
'',
|
|
1404
|
+
` 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`,
|
|
1405
|
+
` echo "::error::The release signing secret doesn't match a key in ${dollar}public_key_file}."`,
|
|
1406
|
+
' exit 1',
|
|
1407
|
+
' fi',
|
|
1408
|
+
'done',
|
|
1409
|
+
'',
|
|
1410
|
+
].join('\n');
|
|
1411
|
+
const releaseSigningKey = Runner.resolveScopedCredExpr(variables, 'RELEASE_SIGNING_KEY', targetSettings, workflowSettings, environment, appPath);
|
|
1412
|
+
return {
|
|
1413
|
+
id: `publish-pfsense-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1414
|
+
needs: context['needs'],
|
|
1415
|
+
runsOn: 'ubuntu-latest',
|
|
1416
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1417
|
+
permissions: {
|
|
1418
|
+
contents: 'write',
|
|
1419
|
+
},
|
|
1420
|
+
steps: [
|
|
1421
|
+
{
|
|
1422
|
+
name: 'Checkout repository',
|
|
1423
|
+
kind: 'checkout',
|
|
1424
|
+
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
name: 'Validate and stage port',
|
|
1428
|
+
kind: 'check',
|
|
1429
|
+
run: validateAndStageRun,
|
|
1430
|
+
runBlock: true,
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
name: 'Add release signing key',
|
|
1434
|
+
kind: 'attest',
|
|
1435
|
+
env: [{
|
|
1436
|
+
key: 'RELEASE_SIGNING_KEY',
|
|
1437
|
+
value: releaseSigningKey,
|
|
1438
|
+
}],
|
|
1439
|
+
run: addSigningKeyRun,
|
|
1440
|
+
runBlock: true,
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
name: 'Build on FreeBSD',
|
|
1444
|
+
kind: 'build',
|
|
1445
|
+
uses: getScaffoldVersion('workflowActionFreebsdVm'),
|
|
1446
|
+
with: [
|
|
1447
|
+
{
|
|
1448
|
+
key: 'release',
|
|
1449
|
+
value: Runner.expr('vars.PFSENSE_FREEBSD_VERSION || \'15\''),
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
key: 'copyback',
|
|
1453
|
+
value: true,
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
key: 'prepare',
|
|
1457
|
+
value: 'pkg install -y ca_root_nss git',
|
|
1458
|
+
block: true,
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
key: 'run',
|
|
1462
|
+
value: freebsdRun,
|
|
1463
|
+
block: true,
|
|
1464
|
+
},
|
|
1465
|
+
],
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
name: 'Sign release packages',
|
|
1469
|
+
kind: 'attest',
|
|
1470
|
+
env: [{
|
|
1471
|
+
key: 'RELEASE_SIGNING_KEY',
|
|
1472
|
+
value: releaseSigningKey,
|
|
1473
|
+
}],
|
|
1474
|
+
run: signReleaseRun,
|
|
1475
|
+
runBlock: true,
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
name: 'Upload workflow artifact',
|
|
1479
|
+
kind: 'artifact',
|
|
1480
|
+
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
1481
|
+
with: [
|
|
1482
|
+
{
|
|
1483
|
+
key: 'name',
|
|
1484
|
+
value: `pfsense-${workspaceName}`,
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
key: 'path',
|
|
1488
|
+
value: `${releaseDirectory}/*`,
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
key: 'if-no-files-found',
|
|
1492
|
+
value: 'error',
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
key: 'retention-days',
|
|
1496
|
+
value: 7,
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
key: 'include-hidden-files',
|
|
1500
|
+
value: true,
|
|
1501
|
+
},
|
|
1502
|
+
],
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
name: 'Upload GitHub release assets',
|
|
1506
|
+
kind: 'deploy',
|
|
1507
|
+
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1508
|
+
env: [
|
|
1509
|
+
{
|
|
1510
|
+
key: 'GH_TOKEN',
|
|
1511
|
+
value: Runner.expr('github.token'),
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
key: 'RELEASE_TAG',
|
|
1515
|
+
value: Runner.expr('github.event.release.tag_name || inputs.tag'),
|
|
1516
|
+
},
|
|
1517
|
+
],
|
|
1518
|
+
run: `gh release upload "$RELEASE_TAG" "${releaseDirectory}/"* --clobber`,
|
|
1519
|
+
runBlock: true,
|
|
1138
1520
|
},
|
|
1139
1521
|
],
|
|
1140
1522
|
};
|
|
@@ -1144,11 +1526,12 @@ export class Runner {
|
|
|
1144
1526
|
const workflowSettings = context['workflowSettings'];
|
|
1145
1527
|
const metadata = Variables.getTargetMetadata('publish', 'github-packages');
|
|
1146
1528
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1529
|
+
const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
|
|
1147
1530
|
return {
|
|
1148
1531
|
id: `publish-github-packages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1149
1532
|
needs: context['needs'],
|
|
1150
1533
|
runsOn: 'ubuntu-latest',
|
|
1151
|
-
timeoutMinutes:
|
|
1534
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1152
1535
|
permissions: {
|
|
1153
1536
|
'contents': 'read',
|
|
1154
1537
|
'packages': 'write',
|
|
@@ -1157,10 +1540,12 @@ export class Runner {
|
|
|
1157
1540
|
steps: [
|
|
1158
1541
|
{
|
|
1159
1542
|
name: 'Checkout repository',
|
|
1543
|
+
kind: 'checkout',
|
|
1160
1544
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1161
1545
|
},
|
|
1162
1546
|
{
|
|
1163
1547
|
name: 'Setup Node.js',
|
|
1548
|
+
kind: 'setup',
|
|
1164
1549
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1165
1550
|
with: [
|
|
1166
1551
|
{
|
|
@@ -1175,6 +1560,7 @@ export class Runner {
|
|
|
1175
1560
|
},
|
|
1176
1561
|
{
|
|
1177
1562
|
name: 'Configure registry for GitHub Packages',
|
|
1563
|
+
kind: 'registry',
|
|
1178
1564
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1179
1565
|
with: [
|
|
1180
1566
|
{
|
|
@@ -1197,10 +1583,12 @@ export class Runner {
|
|
|
1197
1583
|
},
|
|
1198
1584
|
{
|
|
1199
1585
|
name: 'Remove deprecated .npmrc entries',
|
|
1586
|
+
kind: 'setup',
|
|
1200
1587
|
run: Runner.removeDeprecatedNpmrcRun(),
|
|
1201
1588
|
},
|
|
1202
1589
|
{
|
|
1203
1590
|
name: 'Download build artifacts',
|
|
1591
|
+
kind: 'artifact',
|
|
1204
1592
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1205
1593
|
with: [
|
|
1206
1594
|
{
|
|
@@ -1209,17 +1597,19 @@ export class Runner {
|
|
|
1209
1597
|
},
|
|
1210
1598
|
{
|
|
1211
1599
|
key: 'path',
|
|
1212
|
-
value: `${context['workingDir']}/build`,
|
|
1600
|
+
value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
|
|
1213
1601
|
},
|
|
1214
1602
|
],
|
|
1215
1603
|
},
|
|
1216
1604
|
{
|
|
1217
1605
|
name: 'Change to scoped package name',
|
|
1606
|
+
kind: 'setup',
|
|
1218
1607
|
run: Runner.scopePackageNameRun(),
|
|
1219
|
-
workingDirectory:
|
|
1608
|
+
workingDirectory: deployDirectory,
|
|
1220
1609
|
},
|
|
1221
1610
|
{
|
|
1222
1611
|
name: 'Configure authentication',
|
|
1612
|
+
kind: 'registry',
|
|
1223
1613
|
env: [{
|
|
1224
1614
|
key: 'GITHUB_TOKEN',
|
|
1225
1615
|
value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
|
|
@@ -1228,15 +1618,17 @@ export class Runner {
|
|
|
1228
1618
|
},
|
|
1229
1619
|
{
|
|
1230
1620
|
name: 'Publish package to GitHub Packages',
|
|
1621
|
+
kind: 'deploy',
|
|
1231
1622
|
run: Runner.githubPublishRun(),
|
|
1232
|
-
workingDirectory:
|
|
1623
|
+
workingDirectory: deployDirectory,
|
|
1233
1624
|
},
|
|
1234
1625
|
{
|
|
1235
1626
|
name: 'Restore package name',
|
|
1627
|
+
kind: 'setup',
|
|
1236
1628
|
if: Runner.expr('always() && env.PACKAGE_NAME'),
|
|
1237
1629
|
run: 'npm pkg set name="$PACKAGE_NAME"',
|
|
1238
1630
|
runBlock: true,
|
|
1239
|
-
workingDirectory:
|
|
1631
|
+
workingDirectory: deployDirectory,
|
|
1240
1632
|
},
|
|
1241
1633
|
],
|
|
1242
1634
|
};
|
|
@@ -1248,21 +1640,24 @@ export class Runner {
|
|
|
1248
1640
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1249
1641
|
const environment = context['environment'];
|
|
1250
1642
|
const appPath = context['workingDir'];
|
|
1643
|
+
const deployDirectory = context['artifactDirectory'] ?? `${context['workingDir']}/build`;
|
|
1251
1644
|
return {
|
|
1252
1645
|
id: `publish-cloudflare-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1253
1646
|
needs: context['needs'],
|
|
1254
1647
|
runsOn: 'ubuntu-latest',
|
|
1255
|
-
timeoutMinutes:
|
|
1648
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1256
1649
|
permissions: {
|
|
1257
1650
|
contents: 'read',
|
|
1258
1651
|
},
|
|
1259
1652
|
steps: [
|
|
1260
1653
|
{
|
|
1261
1654
|
name: 'Checkout repository',
|
|
1655
|
+
kind: 'checkout',
|
|
1262
1656
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1263
1657
|
},
|
|
1264
1658
|
{
|
|
1265
1659
|
name: 'Setup Node.js',
|
|
1660
|
+
kind: 'setup',
|
|
1266
1661
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1267
1662
|
with: [
|
|
1268
1663
|
{
|
|
@@ -1277,10 +1672,12 @@ export class Runner {
|
|
|
1277
1672
|
},
|
|
1278
1673
|
...((context['packageManager'] === 'npm') ? [] : [{
|
|
1279
1674
|
name: 'Install Corepack',
|
|
1675
|
+
kind: 'install',
|
|
1280
1676
|
run: Runner.corepackBootstrapRun(context['packageManager']),
|
|
1281
1677
|
}]),
|
|
1282
1678
|
{
|
|
1283
1679
|
name: 'Download build artifacts',
|
|
1680
|
+
kind: 'artifact',
|
|
1284
1681
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1285
1682
|
with: [
|
|
1286
1683
|
{
|
|
@@ -1289,12 +1686,13 @@ export class Runner {
|
|
|
1289
1686
|
},
|
|
1290
1687
|
{
|
|
1291
1688
|
key: 'path',
|
|
1292
|
-
value:
|
|
1689
|
+
value: deployDirectory,
|
|
1293
1690
|
},
|
|
1294
1691
|
],
|
|
1295
1692
|
},
|
|
1296
1693
|
{
|
|
1297
1694
|
name: 'Deploy to Cloudflare Pages',
|
|
1695
|
+
kind: 'deploy',
|
|
1298
1696
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1299
1697
|
env: [
|
|
1300
1698
|
{
|
|
@@ -1314,7 +1712,7 @@ export class Runner {
|
|
|
1314
1712
|
value: Runner.expr('github.event.repository.default_branch'),
|
|
1315
1713
|
},
|
|
1316
1714
|
],
|
|
1317
|
-
run: Runner.corepackDownloadCommand(context['packageManager'], 'wrangler@3', `pages deploy ${
|
|
1715
|
+
run: Runner.corepackDownloadCommand(context['packageManager'], 'wrangler@3', `pages deploy ${deployDirectory} --project-name="$CLOUDFLARE_PROJECT_NAME" --branch="$DEFAULT_BRANCH"`),
|
|
1318
1716
|
},
|
|
1319
1717
|
],
|
|
1320
1718
|
};
|
|
@@ -1328,6 +1726,7 @@ export class Runner {
|
|
|
1328
1726
|
const environmentSelection = context['environmentSelection'];
|
|
1329
1727
|
const profileAware = environmentSelection !== undefined;
|
|
1330
1728
|
const appPath = context['workingDir'];
|
|
1729
|
+
const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
|
|
1331
1730
|
const runtimeValues = Runner.appRuntimeValues(environment, appPath, profileAware);
|
|
1332
1731
|
const deployEnv = [
|
|
1333
1732
|
{
|
|
@@ -1343,10 +1742,12 @@ export class Runner {
|
|
|
1343
1742
|
const steps = [
|
|
1344
1743
|
{
|
|
1345
1744
|
name: 'Checkout repository',
|
|
1745
|
+
kind: 'checkout',
|
|
1346
1746
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1347
1747
|
},
|
|
1348
1748
|
{
|
|
1349
1749
|
name: 'Setup Node.js',
|
|
1750
|
+
kind: 'setup',
|
|
1350
1751
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1351
1752
|
with: [
|
|
1352
1753
|
{
|
|
@@ -1361,11 +1762,13 @@ export class Runner {
|
|
|
1361
1762
|
},
|
|
1362
1763
|
{
|
|
1363
1764
|
name: 'Install packages',
|
|
1765
|
+
kind: 'install',
|
|
1364
1766
|
run: Runner.installPackagesRun(context['packageManager']),
|
|
1365
1767
|
workingDirectory: Runner.expr('env.ROOT_DIR'),
|
|
1366
1768
|
},
|
|
1367
1769
|
{
|
|
1368
1770
|
name: 'Download build artifacts',
|
|
1771
|
+
kind: 'artifact',
|
|
1369
1772
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1370
1773
|
with: [
|
|
1371
1774
|
{
|
|
@@ -1374,16 +1777,17 @@ export class Runner {
|
|
|
1374
1777
|
},
|
|
1375
1778
|
{
|
|
1376
1779
|
key: 'path',
|
|
1377
|
-
value: `${context['workingDir']}/build`,
|
|
1780
|
+
value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
|
|
1378
1781
|
},
|
|
1379
1782
|
],
|
|
1380
1783
|
},
|
|
1381
1784
|
{
|
|
1382
1785
|
name: 'Deploy to Cloudflare Workers',
|
|
1786
|
+
kind: 'deploy',
|
|
1383
1787
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1384
1788
|
env: deployEnv,
|
|
1385
1789
|
run: deployRun,
|
|
1386
|
-
workingDirectory:
|
|
1790
|
+
workingDirectory: deployDirectory,
|
|
1387
1791
|
},
|
|
1388
1792
|
];
|
|
1389
1793
|
const environmentSelectionStep = Runner.buildCloudflareEnvironmentSelectionStep(environmentSelection);
|
|
@@ -1393,7 +1797,7 @@ export class Runner {
|
|
|
1393
1797
|
const syncStep = Runner.emitRuntimeSyncStep({
|
|
1394
1798
|
vendor: 'cloudflare',
|
|
1395
1799
|
runtimeValues,
|
|
1396
|
-
workingDir:
|
|
1800
|
+
workingDir: deployDirectory,
|
|
1397
1801
|
packageManager: context['packageManager'],
|
|
1398
1802
|
extraEnv: [
|
|
1399
1803
|
{
|
|
@@ -1413,7 +1817,7 @@ export class Runner {
|
|
|
1413
1817
|
id: `publish-cloudflare-workers-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1414
1818
|
needs: context['needs'],
|
|
1415
1819
|
runsOn: 'ubuntu-latest',
|
|
1416
|
-
timeoutMinutes:
|
|
1820
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1417
1821
|
permissions: {
|
|
1418
1822
|
contents: 'read',
|
|
1419
1823
|
},
|
|
@@ -1429,6 +1833,67 @@ export class Runner {
|
|
|
1429
1833
|
const appPath = context['workingDir'];
|
|
1430
1834
|
const imageNamespace = (targetSettings === undefined) ? 'IMAGE_NAMESPACE' : targetSettings['IMAGE_NAMESPACE'] ?? 'IMAGE_NAMESPACE';
|
|
1431
1835
|
const imageRepository = (targetSettings === undefined) ? 'IMAGE_REPOSITORY' : targetSettings['IMAGE_REPOSITORY'] ?? 'IMAGE_REPOSITORY';
|
|
1836
|
+
const readmePath = Variables.resolve('README_PATH', targetSettings, workflowSettings, variables['README_PATH'] ?? {
|
|
1837
|
+
format: 'literal',
|
|
1838
|
+
default: 'README.md',
|
|
1839
|
+
});
|
|
1840
|
+
const syncDescription = Variables.resolve('SYNC_DESCRIPTION', targetSettings, workflowSettings, variables['SYNC_DESCRIPTION'] ?? {
|
|
1841
|
+
format: 'literal',
|
|
1842
|
+
default: 'true',
|
|
1843
|
+
});
|
|
1844
|
+
const shouldSyncDescription = syncDescription !== 'false';
|
|
1845
|
+
const dockerHubUsername = Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_USERNAME', targetSettings, workflowSettings, environment, appPath);
|
|
1846
|
+
const dockerHubToken = Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_TOKEN', targetSettings, workflowSettings, environment, appPath);
|
|
1847
|
+
const projectDescription = context['projectDescription'] ?? '';
|
|
1848
|
+
const postAttestationSteps = [];
|
|
1849
|
+
if (shouldSyncDescription === true) {
|
|
1850
|
+
postAttestationSteps.push({
|
|
1851
|
+
name: 'Checkout Docker Hub description source',
|
|
1852
|
+
kind: 'checkout',
|
|
1853
|
+
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1854
|
+
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1855
|
+
with: [{
|
|
1856
|
+
key: 'ref',
|
|
1857
|
+
value: Runner.expr('github.event_name == \'workflow_run\' && github.event.workflow_run.head_sha || github.sha'),
|
|
1858
|
+
}],
|
|
1859
|
+
}, {
|
|
1860
|
+
name: 'Sync Docker Hub description (warning only)',
|
|
1861
|
+
kind: 'deploy',
|
|
1862
|
+
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1863
|
+
uses: getScaffoldVersion('workflowActionDockerHubDescription'),
|
|
1864
|
+
continueOnError: true,
|
|
1865
|
+
env: [{
|
|
1866
|
+
key: 'DOCKERHUB_TOKEN',
|
|
1867
|
+
value: dockerHubToken,
|
|
1868
|
+
}],
|
|
1869
|
+
with: [
|
|
1870
|
+
{
|
|
1871
|
+
key: 'username',
|
|
1872
|
+
value: dockerHubUsername,
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
key: 'password',
|
|
1876
|
+
value: Runner.expr('env.DOCKERHUB_TOKEN'),
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
key: 'repository',
|
|
1880
|
+
value: `${imageNamespace}/${imageRepository}`,
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
key: 'short-description',
|
|
1884
|
+
value: projectDescription,
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
key: 'readme-filepath',
|
|
1888
|
+
value: readmePath,
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
key: 'enable-url-completion',
|
|
1892
|
+
value: true,
|
|
1893
|
+
},
|
|
1894
|
+
],
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1432
1897
|
return Runner.buildContainerRegistryTarget(context, {
|
|
1433
1898
|
registrySlug: 'docker-hub',
|
|
1434
1899
|
registryHost: 'docker.io',
|
|
@@ -1436,15 +1901,16 @@ export class Runner {
|
|
|
1436
1901
|
imageRepository,
|
|
1437
1902
|
loginStep: {
|
|
1438
1903
|
name: 'Login to Docker Hub',
|
|
1904
|
+
kind: 'registry',
|
|
1439
1905
|
uses: getScaffoldVersion('workflowActionDockerLogin'),
|
|
1440
1906
|
env: [{
|
|
1441
1907
|
key: 'DOCKERHUB_TOKEN',
|
|
1442
|
-
value:
|
|
1908
|
+
value: dockerHubToken,
|
|
1443
1909
|
}],
|
|
1444
1910
|
with: [
|
|
1445
1911
|
{
|
|
1446
1912
|
key: 'username',
|
|
1447
|
-
value:
|
|
1913
|
+
value: dockerHubUsername,
|
|
1448
1914
|
},
|
|
1449
1915
|
{
|
|
1450
1916
|
key: 'password',
|
|
@@ -1453,6 +1919,7 @@ export class Runner {
|
|
|
1453
1919
|
],
|
|
1454
1920
|
},
|
|
1455
1921
|
extraPermissions: {},
|
|
1922
|
+
postAttestationSteps,
|
|
1456
1923
|
});
|
|
1457
1924
|
}
|
|
1458
1925
|
static buildGhcrTarget(context) {
|
|
@@ -1468,6 +1935,7 @@ export class Runner {
|
|
|
1468
1935
|
imageRepository,
|
|
1469
1936
|
loginStep: {
|
|
1470
1937
|
name: 'Login to GitHub Container Registry',
|
|
1938
|
+
kind: 'registry',
|
|
1471
1939
|
uses: getScaffoldVersion('workflowActionDockerLogin'),
|
|
1472
1940
|
with: [
|
|
1473
1941
|
{
|
|
@@ -1492,6 +1960,7 @@ export class Runner {
|
|
|
1492
1960
|
const workflowSettings = context['workflowSettings'];
|
|
1493
1961
|
const metadata = Variables.getTargetMetadata('publish', 'github-pages');
|
|
1494
1962
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1963
|
+
const deployDirectory = context['artifactDirectory'] ?? `${context['workingDir']}/build`;
|
|
1495
1964
|
const pagesStatusRun = [
|
|
1496
1965
|
`if gh api "repos/${Runner.expr('github.repository')}/pages" > /dev/null 2>&1; then`,
|
|
1497
1966
|
' echo "[Pages] GitHub Pages is enabled."',
|
|
@@ -1505,7 +1974,7 @@ export class Runner {
|
|
|
1505
1974
|
id: `publish-github-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1506
1975
|
needs: context['needs'],
|
|
1507
1976
|
runsOn: 'ubuntu-latest',
|
|
1508
|
-
timeoutMinutes:
|
|
1977
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1509
1978
|
permissions: {
|
|
1510
1979
|
'contents': 'read',
|
|
1511
1980
|
'pages': 'write',
|
|
@@ -1514,10 +1983,12 @@ export class Runner {
|
|
|
1514
1983
|
steps: [
|
|
1515
1984
|
{
|
|
1516
1985
|
name: 'Checkout repository',
|
|
1986
|
+
kind: 'checkout',
|
|
1517
1987
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1518
1988
|
},
|
|
1519
1989
|
{
|
|
1520
1990
|
name: 'Download build artifacts',
|
|
1991
|
+
kind: 'artifact',
|
|
1521
1992
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1522
1993
|
with: [
|
|
1523
1994
|
{
|
|
@@ -1526,12 +1997,13 @@ export class Runner {
|
|
|
1526
1997
|
},
|
|
1527
1998
|
{
|
|
1528
1999
|
key: 'path',
|
|
1529
|
-
value:
|
|
2000
|
+
value: deployDirectory,
|
|
1530
2001
|
},
|
|
1531
2002
|
],
|
|
1532
2003
|
},
|
|
1533
2004
|
{
|
|
1534
2005
|
name: 'Check GitHub Pages status',
|
|
2006
|
+
kind: 'check',
|
|
1535
2007
|
env: [{
|
|
1536
2008
|
key: 'GITHUB_TOKEN',
|
|
1537
2009
|
value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
|
|
@@ -1541,20 +2013,23 @@ export class Runner {
|
|
|
1541
2013
|
},
|
|
1542
2014
|
{
|
|
1543
2015
|
name: 'Setup GitHub Pages',
|
|
2016
|
+
kind: 'setup',
|
|
1544
2017
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1545
2018
|
uses: getScaffoldVersion('workflowActionConfigurePages'),
|
|
1546
2019
|
},
|
|
1547
2020
|
{
|
|
1548
2021
|
name: 'Upload artifact to GitHub Pages',
|
|
2022
|
+
kind: 'artifact',
|
|
1549
2023
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1550
2024
|
uses: getScaffoldVersion('workflowActionUploadPagesArtifact'),
|
|
1551
2025
|
with: [{
|
|
1552
2026
|
key: 'path',
|
|
1553
|
-
value:
|
|
2027
|
+
value: deployDirectory,
|
|
1554
2028
|
}],
|
|
1555
2029
|
},
|
|
1556
2030
|
{
|
|
1557
2031
|
name: 'Deploy to GitHub Pages',
|
|
2032
|
+
kind: 'deploy',
|
|
1558
2033
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
|
|
1559
2034
|
uses: getScaffoldVersion('workflowActionDeployPages'),
|
|
1560
2035
|
},
|
|
@@ -1575,6 +2050,7 @@ export class Runner {
|
|
|
1575
2050
|
const actionYmlPath = Runner.resolveVariableExpr(variables, 'ACTION_YML_PATH', targetSettings, workflowSettings);
|
|
1576
2051
|
const releaseBranchName = Runner.resolveVariableExpr(variables, 'RELEASE_BRANCH_NAME', targetSettings, workflowSettings);
|
|
1577
2052
|
const workspaceDir = context['workingDir'];
|
|
2053
|
+
const deployDirectory = context['artifactDirectory'] ?? actionOutputPath;
|
|
1578
2054
|
const configureGitIdentityRun = [
|
|
1579
2055
|
'set -euo pipefail',
|
|
1580
2056
|
'git config --global user.name "github-actions[bot]"',
|
|
@@ -1611,31 +2087,39 @@ export class Runner {
|
|
|
1611
2087
|
' git rm -rf . > /dev/null 2>&1 || true',
|
|
1612
2088
|
'fi',
|
|
1613
2089
|
].join('\n');
|
|
1614
|
-
|
|
2090
|
+
let stageReleaseTreeRun = [
|
|
1615
2091
|
'set -euo pipefail',
|
|
1616
2092
|
'cd "$GITHUB_WORKSPACE"',
|
|
1617
2093
|
'STAGE="$RUNNER_TEMP/release"',
|
|
1618
|
-
|
|
1619
|
-
'# Required: action.yml and the built action directory.',
|
|
1620
|
-
`cp "${actionYmlPath}" "$STAGE/action.yml"`,
|
|
1621
|
-
'mkdir -p "$STAGE/action"',
|
|
1622
|
-
`cp -R "${actionOutputPath}/." "$STAGE/action/"`,
|
|
1623
|
-
'',
|
|
1624
|
-
'# Repoint action.yml at the bundled entry in the flattened release tree. The',
|
|
1625
|
-
'# source action.yml resolves runs.main against the working layout; the published',
|
|
1626
|
-
'# tree carries only action.yml plus the bundle under action/, so runs.main must',
|
|
1627
|
-
'# resolve there instead. Only the main key inside the runs block is rewritten.',
|
|
1628
|
-
`sed -i -E '/^runs:/,$ s#^([[:space:]]+main:[[:space:]]*).*#\\1"action/${actionEntryPoint}"#' "$STAGE/action.yml"`,
|
|
1629
|
-
'',
|
|
1630
|
-
'# Optional: common community-repo files. Prefer workspace-level over root.',
|
|
1631
|
-
'for optional in README.md LICENSE SECURITY.md NOTICE CHANGELOG.md; do',
|
|
1632
|
-
` if [ -f "${workspaceDir}/$optional" ]; then`,
|
|
1633
|
-
` cp "${workspaceDir}/$optional" "$STAGE/$optional"`,
|
|
1634
|
-
' elif [ -f "$optional" ]; then',
|
|
1635
|
-
' cp "$optional" "$STAGE/$optional"',
|
|
1636
|
-
' fi',
|
|
1637
|
-
'done',
|
|
2094
|
+
`cp -R "${deployDirectory}/." "$STAGE/"`,
|
|
1638
2095
|
].join('\n');
|
|
2096
|
+
if (context['artifactDirectory'] === undefined) {
|
|
2097
|
+
stageReleaseTreeRun = [
|
|
2098
|
+
'set -euo pipefail',
|
|
2099
|
+
'cd "$GITHUB_WORKSPACE"',
|
|
2100
|
+
'STAGE="$RUNNER_TEMP/release"',
|
|
2101
|
+
'',
|
|
2102
|
+
'# Required: action.yml and the built action directory.',
|
|
2103
|
+
`cp "${actionYmlPath}" "$STAGE/action.yml"`,
|
|
2104
|
+
'mkdir -p "$STAGE/action"',
|
|
2105
|
+
`cp -R "${actionOutputPath}/." "$STAGE/action/"`,
|
|
2106
|
+
'',
|
|
2107
|
+
'# Repoint action.yml at the bundled entry in the flattened release tree. The',
|
|
2108
|
+
'# source action.yml resolves runs.main against the working layout; the published',
|
|
2109
|
+
'# tree carries only action.yml plus the bundle under action/, so runs.main must',
|
|
2110
|
+
'# resolve there instead. Only the main key inside the runs block is rewritten.',
|
|
2111
|
+
`sed -i -E '/^runs:/,$ s#^([[:space:]]+main:[[:space:]]*).*#\\1"action/${actionEntryPoint}"#' "$STAGE/action.yml"`,
|
|
2112
|
+
'',
|
|
2113
|
+
'# Optional: common community-repo files. Prefer workspace-level over root.',
|
|
2114
|
+
'for optional in README.md LICENSE SECURITY.md NOTICE CHANGELOG.md; do',
|
|
2115
|
+
` if [ -f "${workspaceDir}/$optional" ]; then`,
|
|
2116
|
+
` cp "${workspaceDir}/$optional" "$STAGE/$optional"`,
|
|
2117
|
+
' elif [ -f "$optional" ]; then',
|
|
2118
|
+
' cp "$optional" "$STAGE/$optional"',
|
|
2119
|
+
' fi',
|
|
2120
|
+
'done',
|
|
2121
|
+
].join('\n');
|
|
2122
|
+
}
|
|
1639
2123
|
const commitAndPushReleaseRun = [
|
|
1640
2124
|
'set -euo pipefail',
|
|
1641
2125
|
'cd "$RUNNER_TEMP/release"',
|
|
@@ -1670,7 +2154,7 @@ export class Runner {
|
|
|
1670
2154
|
id: `publish-github-action-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1671
2155
|
needs: context['needs'],
|
|
1672
2156
|
runsOn: 'ubuntu-latest',
|
|
1673
|
-
timeoutMinutes:
|
|
2157
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1674
2158
|
permissions: {
|
|
1675
2159
|
'contents': 'write',
|
|
1676
2160
|
'id-token': 'write',
|
|
@@ -1679,6 +2163,7 @@ export class Runner {
|
|
|
1679
2163
|
steps: [
|
|
1680
2164
|
{
|
|
1681
2165
|
name: 'Checkout repository',
|
|
2166
|
+
kind: 'checkout',
|
|
1682
2167
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1683
2168
|
with: [{
|
|
1684
2169
|
key: 'persist-credentials',
|
|
@@ -1687,6 +2172,7 @@ export class Runner {
|
|
|
1687
2172
|
},
|
|
1688
2173
|
{
|
|
1689
2174
|
name: 'Download build artifacts',
|
|
2175
|
+
kind: 'artifact',
|
|
1690
2176
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1691
2177
|
with: [
|
|
1692
2178
|
{
|
|
@@ -1695,17 +2181,19 @@ export class Runner {
|
|
|
1695
2181
|
},
|
|
1696
2182
|
{
|
|
1697
2183
|
key: 'path',
|
|
1698
|
-
value:
|
|
2184
|
+
value: deployDirectory,
|
|
1699
2185
|
},
|
|
1700
2186
|
],
|
|
1701
2187
|
},
|
|
1702
2188
|
{
|
|
1703
2189
|
name: 'Configure git identity',
|
|
2190
|
+
kind: 'setup',
|
|
1704
2191
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1705
2192
|
run: configureGitIdentityRun,
|
|
1706
2193
|
},
|
|
1707
2194
|
{
|
|
1708
2195
|
name: 'Verify release context',
|
|
2196
|
+
kind: 'check',
|
|
1709
2197
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1710
2198
|
env: [{
|
|
1711
2199
|
key: 'TAG_NAME',
|
|
@@ -1715,6 +2203,7 @@ export class Runner {
|
|
|
1715
2203
|
},
|
|
1716
2204
|
{
|
|
1717
2205
|
name: 'Initialize release workspace',
|
|
2206
|
+
kind: 'setup',
|
|
1718
2207
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1719
2208
|
env: [
|
|
1720
2209
|
{
|
|
@@ -1730,11 +2219,13 @@ export class Runner {
|
|
|
1730
2219
|
},
|
|
1731
2220
|
{
|
|
1732
2221
|
name: 'Stage release tree',
|
|
2222
|
+
kind: 'setup',
|
|
1733
2223
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1734
2224
|
run: stageReleaseTreeRun,
|
|
1735
2225
|
},
|
|
1736
2226
|
{
|
|
1737
2227
|
name: 'Commit and push release',
|
|
2228
|
+
kind: 'deploy',
|
|
1738
2229
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1739
2230
|
env: [{
|
|
1740
2231
|
key: 'TAG_NAME',
|
|
@@ -1744,6 +2235,7 @@ export class Runner {
|
|
|
1744
2235
|
},
|
|
1745
2236
|
{
|
|
1746
2237
|
name: 'Force-retag semver and floating major',
|
|
2238
|
+
kind: 'deploy',
|
|
1747
2239
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1748
2240
|
env: [
|
|
1749
2241
|
{
|
|
@@ -1759,11 +2251,12 @@ export class Runner {
|
|
|
1759
2251
|
},
|
|
1760
2252
|
{
|
|
1761
2253
|
name: 'Attest build provenance',
|
|
2254
|
+
kind: 'attest',
|
|
1762
2255
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1763
2256
|
uses: getScaffoldVersion('workflowActionAttest'),
|
|
1764
2257
|
with: [{
|
|
1765
2258
|
key: 'subject-path',
|
|
1766
|
-
value: `${actionOutputPath}/${actionEntryPoint}`,
|
|
2259
|
+
value: (context['artifactDirectory'] === undefined) ? `${actionOutputPath}/${actionEntryPoint}` : `${deployDirectory}/action/${actionEntryPoint}`,
|
|
1767
2260
|
}],
|
|
1768
2261
|
},
|
|
1769
2262
|
],
|
|
@@ -1776,15 +2269,18 @@ export class Runner {
|
|
|
1776
2269
|
const variables = (metadata === undefined) ? {} : metadata['variables'];
|
|
1777
2270
|
const environment = context['environment'];
|
|
1778
2271
|
const appPath = context['workingDir'];
|
|
2272
|
+
const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
|
|
1779
2273
|
const dollar = Runner.dollar();
|
|
1780
2274
|
const runtimeValues = Runner.appRuntimeValues(environment, appPath);
|
|
1781
2275
|
const steps = [
|
|
1782
2276
|
{
|
|
1783
2277
|
name: 'Checkout repository',
|
|
2278
|
+
kind: 'checkout',
|
|
1784
2279
|
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
1785
2280
|
},
|
|
1786
2281
|
{
|
|
1787
2282
|
name: 'Setup Node.js',
|
|
2283
|
+
kind: 'setup',
|
|
1788
2284
|
uses: getScaffoldVersion('workflowActionSetupNode'),
|
|
1789
2285
|
with: [
|
|
1790
2286
|
{
|
|
@@ -1799,20 +2295,29 @@ export class Runner {
|
|
|
1799
2295
|
},
|
|
1800
2296
|
{
|
|
1801
2297
|
name: 'Download build artifacts',
|
|
2298
|
+
kind: 'artifact',
|
|
1802
2299
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
1803
|
-
with: [
|
|
2300
|
+
with: [
|
|
2301
|
+
{
|
|
1804
2302
|
key: 'name',
|
|
1805
2303
|
value: context['artifactName'],
|
|
1806
|
-
}
|
|
2304
|
+
},
|
|
2305
|
+
...((context['artifactDirectory'] === undefined) ? [] : [{
|
|
2306
|
+
key: 'path',
|
|
2307
|
+
value: context['artifactDirectory'],
|
|
2308
|
+
}]),
|
|
2309
|
+
],
|
|
1807
2310
|
},
|
|
1808
2311
|
{
|
|
1809
2312
|
name: 'Install Vercel CLI',
|
|
2313
|
+
kind: 'install',
|
|
1810
2314
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1811
2315
|
run: 'npm install -g vercel@latest',
|
|
1812
2316
|
runPlain: true,
|
|
1813
2317
|
},
|
|
1814
2318
|
{
|
|
1815
2319
|
name: 'Pull Vercel environment',
|
|
2320
|
+
kind: 'setup',
|
|
1816
2321
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1817
2322
|
env: [
|
|
1818
2323
|
{
|
|
@@ -1830,11 +2335,12 @@ export class Runner {
|
|
|
1830
2335
|
],
|
|
1831
2336
|
run: `vercel pull --yes --environment=production --token="${dollar}VERCEL_TOKEN}"`,
|
|
1832
2337
|
runBlock: true,
|
|
1833
|
-
workingDirectory:
|
|
2338
|
+
workingDirectory: deployDirectory,
|
|
1834
2339
|
},
|
|
1835
2340
|
];
|
|
1836
2341
|
const deployStep = {
|
|
1837
2342
|
name: 'Deploy to Vercel',
|
|
2343
|
+
kind: 'deploy',
|
|
1838
2344
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
1839
2345
|
env: [
|
|
1840
2346
|
{
|
|
@@ -1852,12 +2358,12 @@ export class Runner {
|
|
|
1852
2358
|
],
|
|
1853
2359
|
run: `vercel deploy --prebuilt --prod --token="${dollar}VERCEL_TOKEN}"`,
|
|
1854
2360
|
runBlock: true,
|
|
1855
|
-
workingDirectory:
|
|
2361
|
+
workingDirectory: deployDirectory,
|
|
1856
2362
|
};
|
|
1857
2363
|
const syncStep = Runner.emitRuntimeSyncStep({
|
|
1858
2364
|
vendor: 'vercel',
|
|
1859
2365
|
runtimeValues,
|
|
1860
|
-
workingDir:
|
|
2366
|
+
workingDir: deployDirectory,
|
|
1861
2367
|
packageManager: context['packageManager'],
|
|
1862
2368
|
extraEnv: [{
|
|
1863
2369
|
key: 'VERCEL_TOKEN',
|
|
@@ -1872,7 +2378,7 @@ export class Runner {
|
|
|
1872
2378
|
id: `publish-vercel-nextjs-${Runner.slugifyWorkingDir(context['workingDir'])}`,
|
|
1873
2379
|
needs: context['needs'],
|
|
1874
2380
|
runsOn: 'ubuntu-latest',
|
|
1875
|
-
timeoutMinutes:
|
|
2381
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
1876
2382
|
permissions: {
|
|
1877
2383
|
contents: 'read',
|
|
1878
2384
|
},
|
|
@@ -1977,31 +2483,56 @@ export class Runner {
|
|
|
1977
2483
|
];
|
|
1978
2484
|
return {
|
|
1979
2485
|
name,
|
|
2486
|
+
kind: 'check',
|
|
1980
2487
|
run: lines.join('\n'),
|
|
1981
2488
|
runBlock: true,
|
|
1982
2489
|
};
|
|
1983
2490
|
}
|
|
1984
|
-
static
|
|
1985
|
-
const
|
|
1986
|
-
|
|
1987
|
-
{
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
{
|
|
2491
|
+
static buildContainerJobs(platforms, timeoutMinutes, checkoutRef) {
|
|
2492
|
+
const labels = [
|
|
2493
|
+
`org.opencontainers.image.version=${Runner.expr('github.event.release.tag_name || inputs.tag || github.ref_name')}`,
|
|
2494
|
+
`org.opencontainers.image.revision=${Runner.expr('github.sha')}`,
|
|
2495
|
+
].join('\n');
|
|
2496
|
+
const jobs = [];
|
|
2497
|
+
const platformJobIds = [];
|
|
2498
|
+
for (const platform of platforms) {
|
|
2499
|
+
const platformSlug = platform.replace(new RegExp(LIB_REGEX_PATTERN_NON_ALPHANUMERIC_RUN, 'g'), '-');
|
|
2500
|
+
const platformJobId = `build-container-${platformSlug}`;
|
|
2501
|
+
const nativeArchitecture = libWorkflowContainerPlatformArchitectures[platform];
|
|
2502
|
+
const cacheScope = `container-${platformSlug}`;
|
|
2503
|
+
const platformSteps = [{
|
|
2504
|
+
name: 'Checkout repository',
|
|
2505
|
+
kind: 'checkout',
|
|
2506
|
+
uses: getScaffoldVersion('workflowActionCheckout'),
|
|
2507
|
+
...((checkoutRef === undefined) ? {} : {
|
|
2508
|
+
with: [{
|
|
2509
|
+
key: 'ref',
|
|
2510
|
+
value: checkoutRef,
|
|
2511
|
+
}],
|
|
2512
|
+
}),
|
|
2513
|
+
}];
|
|
2514
|
+
if (nativeArchitecture === undefined) {
|
|
2515
|
+
platformSteps.push({
|
|
2516
|
+
name: 'Set up QEMU',
|
|
2517
|
+
kind: 'setup',
|
|
2518
|
+
uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
|
|
2519
|
+
with: [{
|
|
2520
|
+
key: 'platforms',
|
|
2521
|
+
value: platform,
|
|
2522
|
+
}],
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
platformSteps.push({
|
|
1996
2526
|
name: 'Set up Docker Buildx',
|
|
2527
|
+
kind: 'setup',
|
|
1997
2528
|
uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
|
|
1998
|
-
},
|
|
1999
|
-
{
|
|
2529
|
+
}, {
|
|
2000
2530
|
name: 'Prepare OCI handoff',
|
|
2531
|
+
kind: 'setup',
|
|
2001
2532
|
run: 'mkdir -p "$RUNNER_TEMP/container-oci"',
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2533
|
+
}, {
|
|
2004
2534
|
name: 'Build immutable OCI artifact',
|
|
2535
|
+
kind: 'build',
|
|
2005
2536
|
id: 'build-oci',
|
|
2006
2537
|
uses: getScaffoldVersion('workflowActionDockerBuildPush'),
|
|
2007
2538
|
with: [
|
|
@@ -2011,7 +2542,7 @@ export class Runner {
|
|
|
2011
2542
|
},
|
|
2012
2543
|
{
|
|
2013
2544
|
key: 'platforms',
|
|
2014
|
-
value:
|
|
2545
|
+
value: platform,
|
|
2015
2546
|
},
|
|
2016
2547
|
{
|
|
2017
2548
|
key: 'push',
|
|
@@ -2025,24 +2556,36 @@ export class Runner {
|
|
|
2025
2556
|
key: 'tags',
|
|
2026
2557
|
value: 'nova.local/container:nova-oci',
|
|
2027
2558
|
},
|
|
2559
|
+
{
|
|
2560
|
+
key: 'labels',
|
|
2561
|
+
value: labels,
|
|
2562
|
+
block: true,
|
|
2563
|
+
},
|
|
2564
|
+
{
|
|
2565
|
+
key: 'cache-from',
|
|
2566
|
+
value: `type=gha,scope=${cacheScope}`,
|
|
2567
|
+
},
|
|
2568
|
+
{
|
|
2569
|
+
key: 'cache-to',
|
|
2570
|
+
value: `type=gha,mode=max,scope=${cacheScope}`,
|
|
2571
|
+
},
|
|
2028
2572
|
{
|
|
2029
2573
|
key: 'outputs',
|
|
2030
2574
|
value: `type=oci,dest=${Runner.expr('runner.temp')}/container-oci/layout,tar=false`,
|
|
2031
2575
|
},
|
|
2032
2576
|
],
|
|
2033
|
-
},
|
|
2034
|
-
{
|
|
2577
|
+
}, {
|
|
2035
2578
|
name: 'Record OCI digest',
|
|
2579
|
+
kind: 'artifact',
|
|
2036
2580
|
run: `printf '%s' '${Runner.expr('steps.build-oci.outputs.digest')}' > "$RUNNER_TEMP/container-oci/container-image.digest"`,
|
|
2037
|
-
},
|
|
2038
|
-
Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')),
|
|
2039
|
-
{
|
|
2581
|
+
}, Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')), {
|
|
2040
2582
|
name: 'Upload immutable OCI artifact',
|
|
2583
|
+
kind: 'artifact',
|
|
2041
2584
|
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
2042
2585
|
with: [
|
|
2043
2586
|
{
|
|
2044
2587
|
key: 'name',
|
|
2045
|
-
value:
|
|
2588
|
+
value: `container-oci-${platformSlug}`,
|
|
2046
2589
|
},
|
|
2047
2590
|
{
|
|
2048
2591
|
key: 'retention-days',
|
|
@@ -2061,8 +2604,94 @@ export class Runner {
|
|
|
2061
2604
|
value: `${Runner.expr('runner.temp')}/container-oci`,
|
|
2062
2605
|
},
|
|
2063
2606
|
],
|
|
2607
|
+
});
|
|
2608
|
+
jobs.push({
|
|
2609
|
+
id: platformJobId,
|
|
2610
|
+
runsOn: 'ubuntu-latest',
|
|
2611
|
+
...((nativeArchitecture === undefined) ? {} : {
|
|
2612
|
+
runnerArchitecture: nativeArchitecture,
|
|
2613
|
+
}),
|
|
2614
|
+
timeoutMinutes,
|
|
2615
|
+
permissions: {
|
|
2616
|
+
contents: 'read',
|
|
2617
|
+
},
|
|
2618
|
+
steps: platformSteps,
|
|
2619
|
+
});
|
|
2620
|
+
platformJobIds.push(platformJobId);
|
|
2621
|
+
}
|
|
2622
|
+
jobs.push({
|
|
2623
|
+
id: 'build-container',
|
|
2624
|
+
needs: [
|
|
2625
|
+
'build',
|
|
2626
|
+
...platformJobIds,
|
|
2627
|
+
],
|
|
2628
|
+
runsOn: 'ubuntu-latest',
|
|
2629
|
+
timeoutMinutes,
|
|
2630
|
+
permissions: {
|
|
2631
|
+
contents: 'read',
|
|
2064
2632
|
},
|
|
2065
|
-
|
|
2633
|
+
steps: [
|
|
2634
|
+
{
|
|
2635
|
+
name: 'Download per-platform OCI artifacts',
|
|
2636
|
+
kind: 'artifact',
|
|
2637
|
+
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
2638
|
+
with: [
|
|
2639
|
+
{
|
|
2640
|
+
key: 'pattern',
|
|
2641
|
+
value: 'container-oci-*',
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
key: 'path',
|
|
2645
|
+
value: `${Runner.expr('runner.temp')}/container-oci-platforms`,
|
|
2646
|
+
},
|
|
2647
|
+
],
|
|
2648
|
+
},
|
|
2649
|
+
{
|
|
2650
|
+
name: 'Set up ORAS',
|
|
2651
|
+
kind: 'setup',
|
|
2652
|
+
uses: getScaffoldVersion('workflowActionSetupOras'),
|
|
2653
|
+
with: [{
|
|
2654
|
+
key: 'version',
|
|
2655
|
+
value: '1.3.3',
|
|
2656
|
+
}],
|
|
2657
|
+
},
|
|
2658
|
+
{
|
|
2659
|
+
name: 'Merge per-platform images',
|
|
2660
|
+
kind: 'build',
|
|
2661
|
+
run: Runner.mergeContainerArtifactsRun(),
|
|
2662
|
+
runBlock: true,
|
|
2663
|
+
},
|
|
2664
|
+
Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')),
|
|
2665
|
+
{
|
|
2666
|
+
name: 'Upload immutable OCI artifact',
|
|
2667
|
+
kind: 'artifact',
|
|
2668
|
+
uses: getScaffoldVersion('workflowActionUploadArtifact'),
|
|
2669
|
+
with: [
|
|
2670
|
+
{
|
|
2671
|
+
key: 'name',
|
|
2672
|
+
value: 'container-oci',
|
|
2673
|
+
},
|
|
2674
|
+
{
|
|
2675
|
+
key: 'retention-days',
|
|
2676
|
+
value: 1,
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
key: 'include-hidden-files',
|
|
2680
|
+
value: true,
|
|
2681
|
+
},
|
|
2682
|
+
{
|
|
2683
|
+
key: 'if-no-files-found',
|
|
2684
|
+
value: 'error',
|
|
2685
|
+
},
|
|
2686
|
+
{
|
|
2687
|
+
key: 'path',
|
|
2688
|
+
value: `${Runner.expr('runner.temp')}/container-oci`,
|
|
2689
|
+
},
|
|
2690
|
+
],
|
|
2691
|
+
},
|
|
2692
|
+
],
|
|
2693
|
+
});
|
|
2694
|
+
return jobs;
|
|
2066
2695
|
}
|
|
2067
2696
|
static buildContainerRegistryTarget(context, config) {
|
|
2068
2697
|
const registrySlug = config['registrySlug'];
|
|
@@ -2071,6 +2700,7 @@ export class Runner {
|
|
|
2071
2700
|
const imageRepository = config['imageRepository'];
|
|
2072
2701
|
const loginStep = config['loginStep'];
|
|
2073
2702
|
const extraPermissions = config['extraPermissions'];
|
|
2703
|
+
const postAttestationSteps = config['postAttestationSteps'] ?? [];
|
|
2074
2704
|
const resolveTagsRun = Runner.resolveContainerTagsRun();
|
|
2075
2705
|
const checkImmutableTagsRun = Runner.checkImmutableContainerTagsRun();
|
|
2076
2706
|
const pushRun = Runner.pushContainerArtifactRun();
|
|
@@ -2081,7 +2711,7 @@ export class Runner {
|
|
|
2081
2711
|
id: `publish-${registrySlug}-root`,
|
|
2082
2712
|
needs: context['needs'],
|
|
2083
2713
|
runsOn: 'ubuntu-latest',
|
|
2084
|
-
timeoutMinutes:
|
|
2714
|
+
timeoutMinutes: context['timeoutMinutes'],
|
|
2085
2715
|
permissions: {
|
|
2086
2716
|
'contents': 'read',
|
|
2087
2717
|
...extraPermissions,
|
|
@@ -2092,6 +2722,7 @@ export class Runner {
|
|
|
2092
2722
|
steps: [
|
|
2093
2723
|
{
|
|
2094
2724
|
name: 'Download immutable OCI artifact',
|
|
2725
|
+
kind: 'artifact',
|
|
2095
2726
|
uses: getScaffoldVersion('workflowActionDownloadArtifact'),
|
|
2096
2727
|
with: [
|
|
2097
2728
|
{
|
|
@@ -2106,6 +2737,7 @@ export class Runner {
|
|
|
2106
2737
|
},
|
|
2107
2738
|
{
|
|
2108
2739
|
name: 'Set up ORAS',
|
|
2740
|
+
kind: 'setup',
|
|
2109
2741
|
uses: getScaffoldVersion('workflowActionSetupOras'),
|
|
2110
2742
|
with: [{
|
|
2111
2743
|
key: 'version',
|
|
@@ -2114,6 +2746,7 @@ export class Runner {
|
|
|
2114
2746
|
},
|
|
2115
2747
|
{
|
|
2116
2748
|
name: 'Resolve image coordinate and tags',
|
|
2749
|
+
kind: 'setup',
|
|
2117
2750
|
env: [
|
|
2118
2751
|
{
|
|
2119
2752
|
key: 'EVENT_NAME',
|
|
@@ -2170,30 +2803,35 @@ export class Runner {
|
|
|
2170
2803
|
loginStep,
|
|
2171
2804
|
{
|
|
2172
2805
|
name: 'Reject conflicting immutable tags',
|
|
2806
|
+
kind: 'check',
|
|
2173
2807
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2174
2808
|
run: checkImmutableTagsRun,
|
|
2175
2809
|
runBlock: true,
|
|
2176
2810
|
},
|
|
2177
2811
|
{
|
|
2178
2812
|
name: 'Push immutable OCI artifact',
|
|
2813
|
+
kind: 'deploy',
|
|
2179
2814
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2180
2815
|
run: pushRun,
|
|
2181
2816
|
runBlock: true,
|
|
2182
2817
|
},
|
|
2183
2818
|
{
|
|
2184
2819
|
name: 'Apply image tags',
|
|
2820
|
+
kind: 'deploy',
|
|
2185
2821
|
if: Runner.expr('env.PUBLISH == \'true\' && env.ADDITIONAL_TAGS != \'\''),
|
|
2186
2822
|
run: tagRun,
|
|
2187
2823
|
runBlock: true,
|
|
2188
2824
|
},
|
|
2189
2825
|
{
|
|
2190
2826
|
name: 'Verify immutable image tags',
|
|
2827
|
+
kind: 'check',
|
|
2191
2828
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2192
2829
|
run: verifyRun,
|
|
2193
2830
|
runBlock: true,
|
|
2194
2831
|
},
|
|
2195
2832
|
{
|
|
2196
2833
|
name: 'Generate build provenance',
|
|
2834
|
+
kind: 'attest',
|
|
2197
2835
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2198
2836
|
uses: getScaffoldVersion('workflowActionAttest'),
|
|
2199
2837
|
with: [
|
|
@@ -2211,8 +2849,10 @@ export class Runner {
|
|
|
2211
2849
|
},
|
|
2212
2850
|
],
|
|
2213
2851
|
},
|
|
2852
|
+
...postAttestationSteps,
|
|
2214
2853
|
{
|
|
2215
2854
|
name: 'Publish latest channel',
|
|
2855
|
+
kind: 'deploy',
|
|
2216
2856
|
if: Runner.expr('env.PUBLISH == \'true\' && env.PUBLISH_LATEST == \'true\''),
|
|
2217
2857
|
run: 'oras tag "$IMAGE@$IMAGE_DIGEST" latest',
|
|
2218
2858
|
},
|
|
@@ -2387,6 +3027,32 @@ export class Runner {
|
|
|
2387
3027
|
'done',
|
|
2388
3028
|
].join('\n');
|
|
2389
3029
|
}
|
|
3030
|
+
static mergeContainerArtifactsRun() {
|
|
3031
|
+
return [
|
|
3032
|
+
'set -euo pipefail',
|
|
3033
|
+
'',
|
|
3034
|
+
'layout_directory="$RUNNER_TEMP/container-oci/layout"',
|
|
3035
|
+
'platform_tags=()',
|
|
3036
|
+
'',
|
|
3037
|
+
'mkdir -p "$RUNNER_TEMP/container-oci"',
|
|
3038
|
+
'',
|
|
3039
|
+
'for platform_directory in "$RUNNER_TEMP"/container-oci-platforms/*/; do',
|
|
3040
|
+
' platform_tag="$(basename "$platform_directory")"',
|
|
3041
|
+
' platform_digest="$(cat "$platform_directory"container-image.digest)"',
|
|
3042
|
+
'',
|
|
3043
|
+
' oras cp --from-oci-layout --to-oci-layout "$platform_directory"layout@"$platform_digest" "$layout_directory:$platform_tag"',
|
|
3044
|
+
' platform_tags+=("$platform_tag")',
|
|
3045
|
+
'done',
|
|
3046
|
+
'',
|
|
3047
|
+
`if [ "${'$'}{#platform_tags[@]}" -eq 0 ]; then`,
|
|
3048
|
+
' echo "No per-platform OCI artifacts were downloaded." >&2',
|
|
3049
|
+
' exit 1',
|
|
3050
|
+
'fi',
|
|
3051
|
+
'',
|
|
3052
|
+
`oras manifest index create --oci-layout "$layout_directory:nova-oci" "${'$'}{platform_tags[@]}"`,
|
|
3053
|
+
'printf \'%s\' "$(oras resolve --oci-layout "$layout_directory:nova-oci")" > "$RUNNER_TEMP/container-oci/container-image.digest"',
|
|
3054
|
+
].join('\n');
|
|
3055
|
+
}
|
|
2390
3056
|
static pushContainerArtifactRun() {
|
|
2391
3057
|
return 'oras cp --from-oci-layout "$RUNNER_TEMP/container-oci/layout@$(cat "$RUNNER_TEMP/container-oci/container-image.digest")" "$IMAGE:$SHA_TAG"';
|
|
2392
3058
|
}
|
|
@@ -2418,10 +3084,14 @@ export class Runner {
|
|
|
2418
3084
|
'echo "IMAGE_DIGEST=$expected_digest" >> "$GITHUB_ENV"',
|
|
2419
3085
|
].join('\n');
|
|
2420
3086
|
}
|
|
2421
|
-
static buildScopeCommand(scriptName, workspaceNames, packageManager) {
|
|
3087
|
+
static buildScopeCommand(scriptName, workspaceNames, artifactNames, packageManager) {
|
|
2422
3088
|
const selectedNames = (workspaceNames.length > 0) ? workspaceNames : ['./'];
|
|
2423
3089
|
const workspaceFlags = selectedNames.map((workspaceName) => `--workspace ${workspaceName}`).join(' ');
|
|
2424
|
-
|
|
3090
|
+
const artifactFlags = artifactNames.map((artifactName) => `--artifact ${artifactName}`).join(' ');
|
|
3091
|
+
if (artifactFlags.length === 0) {
|
|
3092
|
+
return `${packageManager} run ${scriptName} -- ${workspaceFlags}`;
|
|
3093
|
+
}
|
|
3094
|
+
return `${packageManager} run ${scriptName} -- ${workspaceFlags} ${artifactFlags}`;
|
|
2425
3095
|
}
|
|
2426
3096
|
static corepackBootstrapRun(packageManager) {
|
|
2427
3097
|
const corepackVersion = getScaffoldVersion('corepack');
|
|
@@ -2572,7 +3242,7 @@ export class Runner {
|
|
|
2572
3242
|
lines.push(`${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret list | jq -r '.[].name' | while read -r name; do`);
|
|
2573
3243
|
lines.push(' case " $DECLARED " in');
|
|
2574
3244
|
lines.push(' *" $name "*) ;;');
|
|
2575
|
-
lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name"
|
|
3245
|
+
lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name" < /dev/null ;;`);
|
|
2576
3246
|
lines.push(' esac');
|
|
2577
3247
|
lines.push('done');
|
|
2578
3248
|
lines.push('echo "Syncing declared secrets: $DECLARED"');
|
|
@@ -2616,6 +3286,7 @@ export class Runner {
|
|
|
2616
3286
|
const run = lines.join('\n');
|
|
2617
3287
|
return {
|
|
2618
3288
|
name: (vendor === 'cloudflare') ? 'Sync worker runtime secrets' : 'Sync Vercel runtime environment',
|
|
3289
|
+
kind: 'deploy',
|
|
2619
3290
|
if: Runner.expr('env.PUBLISH == \'true\''),
|
|
2620
3291
|
env,
|
|
2621
3292
|
run,
|
|
@@ -2851,7 +3522,7 @@ export class Runner {
|
|
|
2851
3522
|
}
|
|
2852
3523
|
return lines;
|
|
2853
3524
|
}
|
|
2854
|
-
static serializeJobs(jobs) {
|
|
3525
|
+
static serializeJobs(jobs, stepTimeoutMinutes) {
|
|
2855
3526
|
const lines = [];
|
|
2856
3527
|
lines.push('jobs:');
|
|
2857
3528
|
for (const job of jobs) {
|
|
@@ -2887,6 +3558,15 @@ export class Runner {
|
|
|
2887
3558
|
if (stepUses !== undefined) {
|
|
2888
3559
|
lines.push(` uses: ${Runner.quote(stepUses)}`);
|
|
2889
3560
|
}
|
|
3561
|
+
const configuredStepTimeoutMinutes = (stepTimeoutMinutes === undefined) ? undefined : stepTimeoutMinutes[step['kind']];
|
|
3562
|
+
const stepTimeoutDefault = libWorkflowStepTimeoutDefaults[step['kind']];
|
|
3563
|
+
const defaultStepTimeoutMinutes = (stepTimeoutDefault === 'job') ? job['timeoutMinutes'] : stepTimeoutDefault;
|
|
3564
|
+
const renderedStepTimeoutMinutes = Math.min(configuredStepTimeoutMinutes ?? defaultStepTimeoutMinutes, job['timeoutMinutes']);
|
|
3565
|
+
lines.push(` timeout-minutes: ${Runner.serializeScalar(renderedStepTimeoutMinutes)}`);
|
|
3566
|
+
const stepContinueOnError = step['continueOnError'];
|
|
3567
|
+
if (stepContinueOnError !== undefined) {
|
|
3568
|
+
lines.push(` continue-on-error: ${Runner.serializeScalar(stepContinueOnError)}`);
|
|
3569
|
+
}
|
|
2890
3570
|
const stepEnv = step['env'];
|
|
2891
3571
|
const isEnvAfterRun = step['envAfterRun'] === true;
|
|
2892
3572
|
if (stepEnv !== undefined && isEnvAfterRun === false) {
|