@cbnventures/nova 0.38.0 → 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.
Files changed (174) hide show
  1. package/build/package.json +1 -1
  2. package/build/scaffold-versions.json +20 -0
  3. package/build/src/api/app-store-connect.d.ts +17 -2
  4. package/build/src/api/app-store-connect.d.ts.map +1 -1
  5. package/build/src/api/app-store-connect.js +654 -171
  6. package/build/src/api/app-store-connect.js.map +1 -1
  7. package/build/src/api/github-runner-images.d.ts +13 -0
  8. package/build/src/api/github-runner-images.d.ts.map +1 -0
  9. package/build/src/api/github-runner-images.js +238 -0
  10. package/build/src/api/github-runner-images.js.map +1 -0
  11. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
  12. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  13. package/build/src/cli/generate/github/workflows-blueprint-validate.js +210 -3
  14. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  15. package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -4
  16. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  17. package/build/src/cli/generate/github/workflows-blueprint.js +685 -70
  18. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  19. package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
  20. package/build/src/cli/generate/must-haves/agent-conventions.js +1 -0
  21. package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
  22. package/build/src/cli/index.js +12 -1
  23. package/build/src/cli/index.js.map +1 -1
  24. package/build/src/cli/integration/app-store-connect.d.ts +10 -0
  25. package/build/src/cli/integration/app-store-connect.d.ts.map +1 -1
  26. package/build/src/cli/integration/app-store-connect.js +701 -80
  27. package/build/src/cli/integration/app-store-connect.js.map +1 -1
  28. package/build/src/cli/scaffold/package/pfsense.d.ts +3 -0
  29. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  30. package/build/src/cli/scaffold/package/pfsense.js +140 -6
  31. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  32. package/build/src/cli/scaffold/tool/serverless.d.ts +2 -0
  33. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  34. package/build/src/cli/scaffold/tool/serverless.js +35 -1
  35. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  36. package/build/src/cli/utility/changelog.d.ts +7 -0
  37. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  38. package/build/src/cli/utility/changelog.js +800 -7
  39. package/build/src/cli/utility/changelog.js.map +1 -1
  40. package/build/src/cli/utility/configure.d.ts +3 -1
  41. package/build/src/cli/utility/configure.d.ts.map +1 -1
  42. package/build/src/cli/utility/configure.js +196 -20
  43. package/build/src/cli/utility/configure.js.map +1 -1
  44. package/build/src/lib/docker-packaging.d.ts +1 -0
  45. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  46. package/build/src/lib/docker-packaging.js +39 -2
  47. package/build/src/lib/docker-packaging.js.map +1 -1
  48. package/build/src/lib/env-namespace.d.ts.map +1 -1
  49. package/build/src/lib/env-namespace.js +2 -1
  50. package/build/src/lib/env-namespace.js.map +1 -1
  51. package/build/src/lib/item.d.ts +2 -1
  52. package/build/src/lib/item.d.ts.map +1 -1
  53. package/build/src/lib/item.js +18 -0
  54. package/build/src/lib/item.js.map +1 -1
  55. package/build/src/lib/nova-config.d.ts.map +1 -1
  56. package/build/src/lib/nova-config.js +46 -2
  57. package/build/src/lib/nova-config.js.map +1 -1
  58. package/build/src/lib/regex.d.ts +14 -0
  59. package/build/src/lib/regex.d.ts.map +1 -1
  60. package/build/src/lib/regex.js +14 -0
  61. package/build/src/lib/regex.js.map +1 -1
  62. package/build/src/lib/scaffold.d.ts +3 -3
  63. package/build/src/lib/scaffold.d.ts.map +1 -1
  64. package/build/src/lib/scaffold.js +111 -8
  65. package/build/src/lib/scaffold.js.map +1 -1
  66. package/build/src/lib/workflow-templates.d.ts +4 -1
  67. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  68. package/build/src/lib/workflow-templates.js +60 -2
  69. package/build/src/lib/workflow-templates.js.map +1 -1
  70. package/build/src/types/api/app-store-connect.d.ts +476 -33
  71. package/build/src/types/api/github-runner-images.d.ts +199 -0
  72. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +69 -8
  73. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +132 -9
  74. package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
  75. package/build/src/types/cli/scaffold/package/pfsense.d.ts +83 -0
  76. package/build/src/types/cli/scaffold/tool/serverless.d.ts +30 -0
  77. package/build/src/types/cli/utility/changelog.d.ts +327 -1
  78. package/build/src/types/cli/utility/configure.d.ts +92 -4
  79. package/build/src/types/lib/docker-packaging.d.ts +25 -1
  80. package/build/src/types/lib/env-namespace.d.ts +4 -1
  81. package/build/src/types/lib/item.d.ts +7 -0
  82. package/build/src/types/lib/nova-config.d.ts +24 -0
  83. package/build/src/types/lib/regex.d.ts +91 -0
  84. package/build/src/types/lib/scaffold.d.ts +48 -4
  85. package/build/src/types/lib/workflow-templates.d.ts +26 -0
  86. package/build/src/types/shared.d.ts +241 -2
  87. package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -0
  88. package/build/src/types/tests/api/github-runner-images.test.d.ts +113 -0
  89. package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +19 -0
  90. package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +0 -9
  91. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +109 -26
  92. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +123 -30
  93. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +45 -0
  94. package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +2 -2
  95. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +2 -0
  96. package/build/src/types/tests/cli/integration/app-store-connect.test.d.ts +876 -0
  97. package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +21 -0
  98. package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +14 -0
  99. package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +21 -0
  100. package/build/src/types/tests/cli/utility/changelog-fold.test.d.ts +350 -0
  101. package/build/src/types/tests/cli/utility/changelog.test.d.ts +50 -0
  102. package/build/src/types/tests/cli/utility/configure.test.d.ts +55 -0
  103. package/build/src/types/tests/lib/nova-config.test.d.ts +28 -0
  104. package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
  105. package/build/src/types/tests/scaffold-output-contract.test.d.ts +79 -0
  106. package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -0
  107. package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -0
  108. package/build/templates/generators/must-haves/agent-conventions/conventions/pfsense.md +311 -0
  109. package/build/templates/scaffold/app/android/package.json +1 -1
  110. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
  111. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
  112. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
  113. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
  114. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
  115. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
  116. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
  117. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
  118. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
  119. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
  120. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
  121. package/build/templates/scaffold/app/apple/package.json +1 -1
  122. package/build/templates/scaffold/app/astro/package.json +1 -1
  123. package/build/templates/scaffold/app/discord-bot/package.json +1 -1
  124. package/build/templates/scaffold/app/express/package.json +1 -1
  125. package/build/templates/scaffold/app/nextjs/package.json +1 -1
  126. package/build/templates/scaffold/app/vite/package.json +1 -1
  127. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  128. package/build/templates/scaffold/package/github-action/package.json +1 -1
  129. package/build/templates/scaffold/package/homebridge/package.json +1 -1
  130. package/build/templates/scaffold/package/pfsense/package.json +1 -1
  131. package/build/templates/scaffold/package/pfsense/port/Makefile.template +16 -1
  132. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php +93 -0
  133. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php +40 -0
  134. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php +1667 -0
  135. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +161 -13
  136. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +37 -0
  137. package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +203 -8
  138. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg +12 -0
  139. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub +9 -0
  140. package/build/templates/scaffold/package/pfsense/port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php +437 -0
  141. package/build/templates/scaffold/package/pfsense/port/pkg-plist +6 -0
  142. package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +54 -0
  143. package/build/templates/scaffold/package/pfsense/scripts/check-package.mjs +114 -1
  144. package/build/templates/scaffold/package/pfsense/scripts/regex.mjs +10 -0
  145. package/build/templates/scaffold/package/pfsense/tests/updates.php +695 -0
  146. package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +1 -1
  147. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  148. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  149. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  150. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  151. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  152. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  153. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  154. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  155. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  156. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  157. package/build/templates/scaffold-options/docker-image/common/Dockerfile +7 -0
  158. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
  159. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +40 -2
  160. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/landing-page.d.ts +23 -0
  161. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +119 -4
  162. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +25 -3
  163. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/landing-page.ts +278 -0
  164. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +121 -6
  165. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +49 -12
  166. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +3 -1
  167. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/function/landing-page.ts +278 -0
  168. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +17 -2
  169. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +40 -2
  170. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/function/landing-page.d.ts +23 -0
  171. package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json +3 -1
  172. package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +7 -1
  173. package/package.json +1 -1
  174. 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';
@@ -37,6 +39,8 @@ export class Runner {
37
39
  const workspaces = config['workspaces'] ?? {};
38
40
  const artifacts = config['artifacts'] ?? {};
39
41
  const environment = config['environment'] ?? {};
42
+ const projectDescription = (config['project'] !== undefined
43
+ && config['project']['description'] !== undefined) ? config['project']['description']['short'] ?? '' : '';
40
44
  const configPath = join(currentDirectory, 'nova.config.json');
41
45
  let rawConfig = {};
42
46
  try {
@@ -59,16 +63,34 @@ export class Runner {
59
63
  }).info('No workflows configured.');
60
64
  return 'completed';
61
65
  }
62
- const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy'], environment, artifacts);
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);
63
76
  const validatedWorkflows = validation['workflows'];
77
+ const hasValidationErrors = validation['diagnostics'].some((diagnostic) => diagnostic['severity'] === 'error');
64
78
  for (const diagnosticEntry of validation['diagnostics']) {
65
79
  const diagnostic = diagnosticEntry;
66
- Logger.customize({
67
- name: 'Runner.generate',
68
- purpose: 'validate',
69
- }).error(diagnostic['message']);
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
+ }
70
92
  }
71
- if (validation['diagnostics'].length > 0) {
93
+ if (hasValidationErrors === true) {
72
94
  process.exitCode = 1;
73
95
  }
74
96
  const hasPublishWorkflow = validatedWorkflows.some((workflow) => workflow['template'] === 'publish');
@@ -107,7 +129,7 @@ export class Runner {
107
129
  const template = entry['template'];
108
130
  const suffix = entry['name'];
109
131
  const outputFileName = (suffix !== undefined) ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
110
- const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts);
132
+ const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts, projectDescription);
111
133
  const entrySetupLines = Variables.collectSetupLines(entry, outputFileName, environment);
112
134
  generatedSet.add(outputFileName);
113
135
  setupLines.push(...entrySetupLines);
@@ -122,7 +144,7 @@ export class Runner {
122
144
  await saveGeneratedFile(targetPath, serialized, isReplaceFile);
123
145
  }
124
146
  if (isDryRun !== true
125
- && validation['diagnostics'].length === 0
147
+ && hasValidationErrors === false
126
148
  && await pathExists(workflowsDirectory) === true) {
127
149
  let existingEntries = [];
128
150
  try {
@@ -172,7 +194,7 @@ export class Runner {
172
194
  }
173
195
  return 'completed';
174
196
  }
175
- static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
197
+ static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, projectDescription = '') {
176
198
  const template = entry['template'];
177
199
  let workflow = undefined;
178
200
  if (template === 'check-sponsor-gated-issues') {
@@ -182,17 +204,21 @@ export class Runner {
182
204
  workflow = Runner.buildLockInactiveIssues(entry, environment);
183
205
  }
184
206
  else {
185
- workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts);
207
+ workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts, projectDescription);
186
208
  }
187
209
  const runsOn = entry['runsOn'];
188
- const timeoutMinutes = entry['timeoutMinutes'];
189
210
  for (const jobEntry of workflow['jobs']) {
190
211
  const job = jobEntry;
191
212
  if (runsOn !== undefined) {
192
- job.runsOn = runsOn;
193
- }
194
- if (timeoutMinutes !== undefined) {
195
- job.timeoutMinutes = timeoutMinutes;
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);
196
222
  }
197
223
  }
198
224
  return Runner.serialize(workflow);
@@ -216,7 +242,7 @@ export class Runner {
216
242
  lines.push('');
217
243
  lines.push(...Runner.serializeEnv(workflow['env']));
218
244
  lines.push('');
219
- lines.push(...Runner.serializeJobs(workflow['jobs']));
245
+ lines.push(...Runner.serializeJobs(workflow['jobs'], workflow['stepTimeoutMinutes']));
220
246
  return `${lines.join('\n')}\n`;
221
247
  }
222
248
  static buildCheckSponsorGatedIssues(entry, environment = {}) {
@@ -277,6 +303,7 @@ export class Runner {
277
303
  ];
278
304
  const step = {
279
305
  name: 'Check support issues',
306
+ kind: 'deploy',
280
307
  uses: getScaffoldVersion('workflowActionSponsorGatedSupport'),
281
308
  env: [
282
309
  {
@@ -338,7 +365,7 @@ export class Runner {
338
365
  const job = {
339
366
  id: 'check-issues',
340
367
  runsOn: 'ubuntu-latest',
341
- timeoutMinutes: 5,
368
+ timeoutMinutes: entry['timeoutMinutes'] ?? 5,
342
369
  permissions: {
343
370
  contents: 'read',
344
371
  issues: 'write',
@@ -346,6 +373,7 @@ export class Runner {
346
373
  steps: [
347
374
  {
348
375
  name: 'Checkout repository',
376
+ kind: 'checkout',
349
377
  uses: getScaffoldVersion('workflowActionCheckout'),
350
378
  },
351
379
  step,
@@ -363,6 +391,7 @@ export class Runner {
363
391
  cancelInProgress: false,
364
392
  },
365
393
  env,
394
+ ...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
366
395
  jobs: [job],
367
396
  };
368
397
  }
@@ -404,6 +433,7 @@ export class Runner {
404
433
  const variables = (metadata === undefined) ? {} : metadata['variables'];
405
434
  const step = {
406
435
  name: 'Lock inactive threads',
436
+ kind: 'deploy',
407
437
  uses: getScaffoldVersion('workflowActionLockInactiveThreads'),
408
438
  env: [{
409
439
  key: 'GITHUB_TOKEN',
@@ -451,7 +481,7 @@ export class Runner {
451
481
  const job = {
452
482
  id: 'lock-inactive-issues',
453
483
  runsOn: 'ubuntu-latest',
454
- timeoutMinutes: 5,
484
+ timeoutMinutes: entry['timeoutMinutes'] ?? 5,
455
485
  steps: [step],
456
486
  };
457
487
  return {
@@ -467,10 +497,11 @@ export class Runner {
467
497
  cancelInProgress: false,
468
498
  },
469
499
  env,
500
+ ...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
470
501
  jobs: [job],
471
502
  };
472
503
  }
473
- static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
504
+ static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}, projectDescription = '') {
474
505
  const suffix = entry['name'];
475
506
  const workflowId = Runner.resolveWorkflowId(suffix);
476
507
  const on = [];
@@ -482,6 +513,7 @@ export class Runner {
482
513
  const profileAware = environmentSelection !== undefined;
483
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\'';
484
515
  const hasContainerTarget = targets.some((target) => target['to'] === 'docker-hub' || target['to'] === 'ghcr');
516
+ const hasPfsenseTarget = targets.some((target) => target['to'] === 'pfsense');
485
517
  const containerPlatforms = entry['containerPlatforms'] ?? [
486
518
  'linux/amd64',
487
519
  'linux/arm64',
@@ -590,7 +622,16 @@ export class Runner {
590
622
  type: 'boolean',
591
623
  default: true,
592
624
  }];
593
- if (hasContainerTarget === true) {
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) {
594
635
  dispatchInputs.push({
595
636
  name: 'tag',
596
637
  description: 'Required image tag when manually publishing',
@@ -668,6 +709,7 @@ export class Runner {
668
709
  const steps = [
669
710
  {
670
711
  name: 'Checkout repository',
712
+ kind: 'checkout',
671
713
  uses: getScaffoldVersion('workflowActionCheckout'),
672
714
  with: [
673
715
  {
@@ -682,6 +724,7 @@ export class Runner {
682
724
  },
683
725
  {
684
726
  name: 'Setup Node.js',
727
+ kind: 'setup',
685
728
  uses: getScaffoldVersion('workflowActionSetupNode'),
686
729
  with: [
687
730
  {
@@ -696,6 +739,7 @@ export class Runner {
696
739
  },
697
740
  {
698
741
  name: 'Install packages',
742
+ kind: 'install',
699
743
  run: Runner.installPackagesRun(packageManager),
700
744
  workingDirectory: Runner.expr('env.ROOT_DIR'),
701
745
  },
@@ -715,6 +759,7 @@ export class Runner {
715
759
  }
716
760
  const writeEnvStep = {
717
761
  name: `Write environment file (${Runner.slugifyWorkingDir(scope)})`,
762
+ kind: 'setup',
718
763
  env: buildValues.map((buildValue) => ({
719
764
  key: buildValue['key'],
720
765
  value: Runner.resolveDeliveryValueExpr(buildValue),
@@ -727,6 +772,7 @@ export class Runner {
727
772
  }
728
773
  steps.push({
729
774
  name: 'Check project',
775
+ kind: 'check',
730
776
  run: checkCommand,
731
777
  runBlock: true,
732
778
  workingDirectory: Runner.expr('env.ROOT_DIR'),
@@ -734,6 +780,7 @@ export class Runner {
734
780
  if (names.length > 0) {
735
781
  steps.push({
736
782
  name: 'Build project',
783
+ kind: 'build',
737
784
  run: buildCommand,
738
785
  runBlock: true,
739
786
  workingDirectory: Runner.expr('env.ROOT_DIR'),
@@ -742,6 +789,7 @@ export class Runner {
742
789
  if (hasContainerTarget === true) {
743
790
  steps.push({
744
791
  name: 'Validate manual container tag',
792
+ kind: 'check',
745
793
  if: Runner.expr('github.event_name == \'workflow_dispatch\' && !inputs.dry-run'),
746
794
  env: [{
747
795
  key: 'MANUAL_TAG',
@@ -782,6 +830,7 @@ export class Runner {
782
830
  const uploadArtifactName = (uploadConfiguredArtifactName === undefined) ? `build-${uploadTarget['to']}-${Runner.slugifyWorkingDir(uploadTarget['path'])}` : `artifact-${uploadConfiguredArtifactName}`;
783
831
  const uploadStep = {
784
832
  name: (uploadConfiguredArtifactName === undefined) ? `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})` : `Upload assembled artifact (${uploadConfiguredArtifactName})`,
833
+ kind: 'artifact',
785
834
  uses: getScaffoldVersion('workflowActionUploadArtifact'),
786
835
  with: [
787
836
  {
@@ -820,25 +869,32 @@ export class Runner {
820
869
  if (artifactPreflightPaths.length > 0) {
821
870
  steps.push(Runner.buildArtifactPreflightStep('Validate build artifacts', artifactPreflightPaths, Runner.expr('github.workspace')), ...artifactUploadSteps);
822
871
  }
823
- if (hasContainerTarget === true) {
824
- const containerArtifactSteps = Runner.buildContainerArtifactSteps(containerPlatforms);
825
- steps.push(...containerArtifactSteps);
826
- }
872
+ const configuredTimeoutMinutes = entry['timeoutMinutes'];
873
+ const configuredBuildTimeoutMinutes = entry['buildTimeoutMinutes'];
827
874
  const buildJob = {
828
875
  id: 'build',
829
876
  runsOn: 'ubuntu-latest',
830
- timeoutMinutes: 15,
877
+ timeoutMinutes: configuredBuildTimeoutMinutes
878
+ ?? configuredTimeoutMinutes
879
+ ?? 15,
831
880
  permissions: {
832
881
  contents: 'read',
833
882
  },
834
883
  steps,
835
884
  };
836
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
+ }
837
890
  for (const target of targets) {
838
891
  const deployTarget = target;
839
892
  const targetSettings = deployTarget['with'];
840
893
  const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
841
894
  const deployConfiguredArtifactName = deployTarget['artifact'];
895
+ const deployTimeoutMinutes = deployTarget['timeoutMinutes']
896
+ ?? configuredTimeoutMinutes
897
+ ?? 15;
842
898
  let deployArtifactName = `artifact-${deployConfiguredArtifactName}`;
843
899
  if (isContainerTarget === true) {
844
900
  deployArtifactName = 'container-oci';
@@ -850,12 +906,14 @@ export class Runner {
850
906
  workingDir: deployTarget['path'],
851
907
  artifactName: deployArtifactName,
852
908
  ...((deployConfiguredArtifactName === undefined) ? {} : { artifactDirectory: `build/${deployConfiguredArtifactName}` }),
853
- needs: (isContainerTarget === true) ? ['build'] : Runner.resolveDeployNeeds(deployTarget),
909
+ needs: (isContainerTarget === true) ? ['build-container'] : Runner.resolveDeployNeeds(deployTarget),
854
910
  targetSettings,
855
911
  workflowSettings,
856
912
  workspace: workspaces[deployTarget['path']],
857
913
  environment,
858
914
  packageManager,
915
+ timeoutMinutes: deployTimeoutMinutes,
916
+ projectDescription,
859
917
  ...((environmentSelection === undefined) ? {} : { environmentSelection }),
860
918
  };
861
919
  if (deployTarget['to'] === 'npm') {
@@ -882,16 +940,13 @@ export class Runner {
882
940
  else if (deployTarget['to'] === 'github-action') {
883
941
  jobs.push(Runner.buildGithubActionTarget(context));
884
942
  }
943
+ else if (deployTarget['to'] === 'pfsense') {
944
+ jobs.push(Runner.buildPfsenseTarget(context));
945
+ }
885
946
  else if (deployTarget['to'] === 'vercel-nextjs') {
886
947
  jobs.push(Runner.buildVercelNextjsTarget(context));
887
948
  }
888
949
  }
889
- const configuredTimeoutMinutes = entry['timeoutMinutes'];
890
- if (configuredTimeoutMinutes !== undefined) {
891
- for (const configuredJob of jobs) {
892
- configuredJob.timeoutMinutes = configuredTimeoutMinutes;
893
- }
894
- }
895
950
  if (jobsCondition !== undefined) {
896
951
  for (const gatedJob of jobs) {
897
952
  Reflect.set(gatedJob, 'if', jobsCondition);
@@ -909,6 +964,7 @@ export class Runner {
909
964
  cancelInProgress: false,
910
965
  },
911
966
  env,
967
+ ...((entry['stepTimeoutMinutes'] === undefined) ? {} : { stepTimeoutMinutes: entry['stepTimeoutMinutes'] }),
912
968
  jobs,
913
969
  };
914
970
  }
@@ -952,6 +1008,7 @@ export class Runner {
952
1008
  ];
953
1009
  return {
954
1010
  name: 'Select Cloudflare deployment environment',
1011
+ kind: 'setup',
955
1012
  env: [
956
1013
  {
957
1014
  key: 'MANUAL_ENVIRONMENT',
@@ -1069,6 +1126,7 @@ export class Runner {
1069
1126
  }
1070
1127
  return {
1071
1128
  name: 'Validate Cloudflare deployment environment',
1129
+ kind: 'check',
1072
1130
  env,
1073
1131
  run: lines.join('\n'),
1074
1132
  runBlock: true,
@@ -1118,7 +1176,7 @@ export class Runner {
1118
1176
  id: `publish-npm-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1119
1177
  needs: context['needs'],
1120
1178
  runsOn: 'ubuntu-latest',
1121
- timeoutMinutes: 10,
1179
+ timeoutMinutes: context['timeoutMinutes'],
1122
1180
  permissions: {
1123
1181
  'contents': 'read',
1124
1182
  'id-token': 'write',
@@ -1126,10 +1184,12 @@ export class Runner {
1126
1184
  steps: [
1127
1185
  {
1128
1186
  name: 'Checkout repository',
1187
+ kind: 'checkout',
1129
1188
  uses: getScaffoldVersion('workflowActionCheckout'),
1130
1189
  },
1131
1190
  {
1132
1191
  name: 'Setup Node.js',
1192
+ kind: 'setup',
1133
1193
  uses: getScaffoldVersion('workflowActionSetupNode'),
1134
1194
  with: [
1135
1195
  {
@@ -1148,10 +1208,12 @@ export class Runner {
1148
1208
  },
1149
1209
  {
1150
1210
  name: 'Remove deprecated .npmrc entries',
1211
+ kind: 'setup',
1151
1212
  run: Runner.removeDeprecatedNpmrcRun(),
1152
1213
  },
1153
1214
  {
1154
1215
  name: 'Download build artifacts',
1216
+ kind: 'artifact',
1155
1217
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1156
1218
  with: [
1157
1219
  {
@@ -1166,6 +1228,7 @@ export class Runner {
1166
1228
  },
1167
1229
  {
1168
1230
  name: 'Configure authentication',
1231
+ kind: 'registry',
1169
1232
  env: [{
1170
1233
  key: 'NPM_TOKEN',
1171
1234
  value: Runner.resolveScopedCredExpr(variables, 'NPM_TOKEN', targetSettings, workflowSettings, environment, appPath),
@@ -1174,12 +1237,290 @@ export class Runner {
1174
1237
  },
1175
1238
  {
1176
1239
  name: 'Publish package to npm',
1240
+ kind: 'deploy',
1177
1241
  run: Runner.npmPublishRun(),
1178
1242
  workingDirectory: deployDirectory,
1179
1243
  },
1180
1244
  ],
1181
1245
  };
1182
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,
1520
+ },
1521
+ ],
1522
+ };
1523
+ }
1183
1524
  static buildGithubPackagesTarget(context) {
1184
1525
  const targetSettings = context['targetSettings'];
1185
1526
  const workflowSettings = context['workflowSettings'];
@@ -1190,7 +1531,7 @@ export class Runner {
1190
1531
  id: `publish-github-packages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1191
1532
  needs: context['needs'],
1192
1533
  runsOn: 'ubuntu-latest',
1193
- timeoutMinutes: 10,
1534
+ timeoutMinutes: context['timeoutMinutes'],
1194
1535
  permissions: {
1195
1536
  'contents': 'read',
1196
1537
  'packages': 'write',
@@ -1199,10 +1540,12 @@ export class Runner {
1199
1540
  steps: [
1200
1541
  {
1201
1542
  name: 'Checkout repository',
1543
+ kind: 'checkout',
1202
1544
  uses: getScaffoldVersion('workflowActionCheckout'),
1203
1545
  },
1204
1546
  {
1205
1547
  name: 'Setup Node.js',
1548
+ kind: 'setup',
1206
1549
  uses: getScaffoldVersion('workflowActionSetupNode'),
1207
1550
  with: [
1208
1551
  {
@@ -1217,6 +1560,7 @@ export class Runner {
1217
1560
  },
1218
1561
  {
1219
1562
  name: 'Configure registry for GitHub Packages',
1563
+ kind: 'registry',
1220
1564
  uses: getScaffoldVersion('workflowActionSetupNode'),
1221
1565
  with: [
1222
1566
  {
@@ -1239,10 +1583,12 @@ export class Runner {
1239
1583
  },
1240
1584
  {
1241
1585
  name: 'Remove deprecated .npmrc entries',
1586
+ kind: 'setup',
1242
1587
  run: Runner.removeDeprecatedNpmrcRun(),
1243
1588
  },
1244
1589
  {
1245
1590
  name: 'Download build artifacts',
1591
+ kind: 'artifact',
1246
1592
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1247
1593
  with: [
1248
1594
  {
@@ -1257,11 +1603,13 @@ export class Runner {
1257
1603
  },
1258
1604
  {
1259
1605
  name: 'Change to scoped package name',
1606
+ kind: 'setup',
1260
1607
  run: Runner.scopePackageNameRun(),
1261
1608
  workingDirectory: deployDirectory,
1262
1609
  },
1263
1610
  {
1264
1611
  name: 'Configure authentication',
1612
+ kind: 'registry',
1265
1613
  env: [{
1266
1614
  key: 'GITHUB_TOKEN',
1267
1615
  value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
@@ -1270,11 +1618,13 @@ export class Runner {
1270
1618
  },
1271
1619
  {
1272
1620
  name: 'Publish package to GitHub Packages',
1621
+ kind: 'deploy',
1273
1622
  run: Runner.githubPublishRun(),
1274
1623
  workingDirectory: deployDirectory,
1275
1624
  },
1276
1625
  {
1277
1626
  name: 'Restore package name',
1627
+ kind: 'setup',
1278
1628
  if: Runner.expr('always() && env.PACKAGE_NAME'),
1279
1629
  run: 'npm pkg set name="$PACKAGE_NAME"',
1280
1630
  runBlock: true,
@@ -1295,17 +1645,19 @@ export class Runner {
1295
1645
  id: `publish-cloudflare-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1296
1646
  needs: context['needs'],
1297
1647
  runsOn: 'ubuntu-latest',
1298
- timeoutMinutes: 10,
1648
+ timeoutMinutes: context['timeoutMinutes'],
1299
1649
  permissions: {
1300
1650
  contents: 'read',
1301
1651
  },
1302
1652
  steps: [
1303
1653
  {
1304
1654
  name: 'Checkout repository',
1655
+ kind: 'checkout',
1305
1656
  uses: getScaffoldVersion('workflowActionCheckout'),
1306
1657
  },
1307
1658
  {
1308
1659
  name: 'Setup Node.js',
1660
+ kind: 'setup',
1309
1661
  uses: getScaffoldVersion('workflowActionSetupNode'),
1310
1662
  with: [
1311
1663
  {
@@ -1320,10 +1672,12 @@ export class Runner {
1320
1672
  },
1321
1673
  ...((context['packageManager'] === 'npm') ? [] : [{
1322
1674
  name: 'Install Corepack',
1675
+ kind: 'install',
1323
1676
  run: Runner.corepackBootstrapRun(context['packageManager']),
1324
1677
  }]),
1325
1678
  {
1326
1679
  name: 'Download build artifacts',
1680
+ kind: 'artifact',
1327
1681
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1328
1682
  with: [
1329
1683
  {
@@ -1338,6 +1692,7 @@ export class Runner {
1338
1692
  },
1339
1693
  {
1340
1694
  name: 'Deploy to Cloudflare Pages',
1695
+ kind: 'deploy',
1341
1696
  if: Runner.expr('env.PUBLISH == \'true\''),
1342
1697
  env: [
1343
1698
  {
@@ -1387,10 +1742,12 @@ export class Runner {
1387
1742
  const steps = [
1388
1743
  {
1389
1744
  name: 'Checkout repository',
1745
+ kind: 'checkout',
1390
1746
  uses: getScaffoldVersion('workflowActionCheckout'),
1391
1747
  },
1392
1748
  {
1393
1749
  name: 'Setup Node.js',
1750
+ kind: 'setup',
1394
1751
  uses: getScaffoldVersion('workflowActionSetupNode'),
1395
1752
  with: [
1396
1753
  {
@@ -1405,11 +1762,13 @@ export class Runner {
1405
1762
  },
1406
1763
  {
1407
1764
  name: 'Install packages',
1765
+ kind: 'install',
1408
1766
  run: Runner.installPackagesRun(context['packageManager']),
1409
1767
  workingDirectory: Runner.expr('env.ROOT_DIR'),
1410
1768
  },
1411
1769
  {
1412
1770
  name: 'Download build artifacts',
1771
+ kind: 'artifact',
1413
1772
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1414
1773
  with: [
1415
1774
  {
@@ -1424,6 +1783,7 @@ export class Runner {
1424
1783
  },
1425
1784
  {
1426
1785
  name: 'Deploy to Cloudflare Workers',
1786
+ kind: 'deploy',
1427
1787
  if: Runner.expr('env.PUBLISH == \'true\''),
1428
1788
  env: deployEnv,
1429
1789
  run: deployRun,
@@ -1457,7 +1817,7 @@ export class Runner {
1457
1817
  id: `publish-cloudflare-workers-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1458
1818
  needs: context['needs'],
1459
1819
  runsOn: 'ubuntu-latest',
1460
- timeoutMinutes: 10,
1820
+ timeoutMinutes: context['timeoutMinutes'],
1461
1821
  permissions: {
1462
1822
  contents: 'read',
1463
1823
  },
@@ -1473,6 +1833,67 @@ export class Runner {
1473
1833
  const appPath = context['workingDir'];
1474
1834
  const imageNamespace = (targetSettings === undefined) ? 'IMAGE_NAMESPACE' : targetSettings['IMAGE_NAMESPACE'] ?? 'IMAGE_NAMESPACE';
1475
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
+ }
1476
1897
  return Runner.buildContainerRegistryTarget(context, {
1477
1898
  registrySlug: 'docker-hub',
1478
1899
  registryHost: 'docker.io',
@@ -1480,15 +1901,16 @@ export class Runner {
1480
1901
  imageRepository,
1481
1902
  loginStep: {
1482
1903
  name: 'Login to Docker Hub',
1904
+ kind: 'registry',
1483
1905
  uses: getScaffoldVersion('workflowActionDockerLogin'),
1484
1906
  env: [{
1485
1907
  key: 'DOCKERHUB_TOKEN',
1486
- value: Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_TOKEN', targetSettings, workflowSettings, environment, appPath),
1908
+ value: dockerHubToken,
1487
1909
  }],
1488
1910
  with: [
1489
1911
  {
1490
1912
  key: 'username',
1491
- value: Runner.resolveScopedCredExpr(variables, 'DOCKERHUB_USERNAME', targetSettings, workflowSettings, environment, appPath),
1913
+ value: dockerHubUsername,
1492
1914
  },
1493
1915
  {
1494
1916
  key: 'password',
@@ -1497,6 +1919,7 @@ export class Runner {
1497
1919
  ],
1498
1920
  },
1499
1921
  extraPermissions: {},
1922
+ postAttestationSteps,
1500
1923
  });
1501
1924
  }
1502
1925
  static buildGhcrTarget(context) {
@@ -1512,6 +1935,7 @@ export class Runner {
1512
1935
  imageRepository,
1513
1936
  loginStep: {
1514
1937
  name: 'Login to GitHub Container Registry',
1938
+ kind: 'registry',
1515
1939
  uses: getScaffoldVersion('workflowActionDockerLogin'),
1516
1940
  with: [
1517
1941
  {
@@ -1550,7 +1974,7 @@ export class Runner {
1550
1974
  id: `publish-github-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1551
1975
  needs: context['needs'],
1552
1976
  runsOn: 'ubuntu-latest',
1553
- timeoutMinutes: 10,
1977
+ timeoutMinutes: context['timeoutMinutes'],
1554
1978
  permissions: {
1555
1979
  'contents': 'read',
1556
1980
  'pages': 'write',
@@ -1559,10 +1983,12 @@ export class Runner {
1559
1983
  steps: [
1560
1984
  {
1561
1985
  name: 'Checkout repository',
1986
+ kind: 'checkout',
1562
1987
  uses: getScaffoldVersion('workflowActionCheckout'),
1563
1988
  },
1564
1989
  {
1565
1990
  name: 'Download build artifacts',
1991
+ kind: 'artifact',
1566
1992
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1567
1993
  with: [
1568
1994
  {
@@ -1577,6 +2003,7 @@ export class Runner {
1577
2003
  },
1578
2004
  {
1579
2005
  name: 'Check GitHub Pages status',
2006
+ kind: 'check',
1580
2007
  env: [{
1581
2008
  key: 'GITHUB_TOKEN',
1582
2009
  value: Runner.resolveVariableExpr(variables, 'GITHUB_TOKEN', targetSettings, workflowSettings),
@@ -1586,11 +2013,13 @@ export class Runner {
1586
2013
  },
1587
2014
  {
1588
2015
  name: 'Setup GitHub Pages',
2016
+ kind: 'setup',
1589
2017
  if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
1590
2018
  uses: getScaffoldVersion('workflowActionConfigurePages'),
1591
2019
  },
1592
2020
  {
1593
2021
  name: 'Upload artifact to GitHub Pages',
2022
+ kind: 'artifact',
1594
2023
  if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
1595
2024
  uses: getScaffoldVersion('workflowActionUploadPagesArtifact'),
1596
2025
  with: [{
@@ -1600,6 +2029,7 @@ export class Runner {
1600
2029
  },
1601
2030
  {
1602
2031
  name: 'Deploy to GitHub Pages',
2032
+ kind: 'deploy',
1603
2033
  if: Runner.expr('env.PUBLISH == \'true\' && env.PAGES_ENABLED == \'true\''),
1604
2034
  uses: getScaffoldVersion('workflowActionDeployPages'),
1605
2035
  },
@@ -1724,7 +2154,7 @@ export class Runner {
1724
2154
  id: `publish-github-action-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1725
2155
  needs: context['needs'],
1726
2156
  runsOn: 'ubuntu-latest',
1727
- timeoutMinutes: 10,
2157
+ timeoutMinutes: context['timeoutMinutes'],
1728
2158
  permissions: {
1729
2159
  'contents': 'write',
1730
2160
  'id-token': 'write',
@@ -1733,6 +2163,7 @@ export class Runner {
1733
2163
  steps: [
1734
2164
  {
1735
2165
  name: 'Checkout repository',
2166
+ kind: 'checkout',
1736
2167
  uses: getScaffoldVersion('workflowActionCheckout'),
1737
2168
  with: [{
1738
2169
  key: 'persist-credentials',
@@ -1741,6 +2172,7 @@ export class Runner {
1741
2172
  },
1742
2173
  {
1743
2174
  name: 'Download build artifacts',
2175
+ kind: 'artifact',
1744
2176
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1745
2177
  with: [
1746
2178
  {
@@ -1755,11 +2187,13 @@ export class Runner {
1755
2187
  },
1756
2188
  {
1757
2189
  name: 'Configure git identity',
2190
+ kind: 'setup',
1758
2191
  if: Runner.expr('env.PUBLISH == \'true\''),
1759
2192
  run: configureGitIdentityRun,
1760
2193
  },
1761
2194
  {
1762
2195
  name: 'Verify release context',
2196
+ kind: 'check',
1763
2197
  if: Runner.expr('env.PUBLISH == \'true\''),
1764
2198
  env: [{
1765
2199
  key: 'TAG_NAME',
@@ -1769,6 +2203,7 @@ export class Runner {
1769
2203
  },
1770
2204
  {
1771
2205
  name: 'Initialize release workspace',
2206
+ kind: 'setup',
1772
2207
  if: Runner.expr('env.PUBLISH == \'true\''),
1773
2208
  env: [
1774
2209
  {
@@ -1784,11 +2219,13 @@ export class Runner {
1784
2219
  },
1785
2220
  {
1786
2221
  name: 'Stage release tree',
2222
+ kind: 'setup',
1787
2223
  if: Runner.expr('env.PUBLISH == \'true\''),
1788
2224
  run: stageReleaseTreeRun,
1789
2225
  },
1790
2226
  {
1791
2227
  name: 'Commit and push release',
2228
+ kind: 'deploy',
1792
2229
  if: Runner.expr('env.PUBLISH == \'true\''),
1793
2230
  env: [{
1794
2231
  key: 'TAG_NAME',
@@ -1798,6 +2235,7 @@ export class Runner {
1798
2235
  },
1799
2236
  {
1800
2237
  name: 'Force-retag semver and floating major',
2238
+ kind: 'deploy',
1801
2239
  if: Runner.expr('env.PUBLISH == \'true\''),
1802
2240
  env: [
1803
2241
  {
@@ -1813,6 +2251,7 @@ export class Runner {
1813
2251
  },
1814
2252
  {
1815
2253
  name: 'Attest build provenance',
2254
+ kind: 'attest',
1816
2255
  if: Runner.expr('env.PUBLISH == \'true\''),
1817
2256
  uses: getScaffoldVersion('workflowActionAttest'),
1818
2257
  with: [{
@@ -1836,10 +2275,12 @@ export class Runner {
1836
2275
  const steps = [
1837
2276
  {
1838
2277
  name: 'Checkout repository',
2278
+ kind: 'checkout',
1839
2279
  uses: getScaffoldVersion('workflowActionCheckout'),
1840
2280
  },
1841
2281
  {
1842
2282
  name: 'Setup Node.js',
2283
+ kind: 'setup',
1843
2284
  uses: getScaffoldVersion('workflowActionSetupNode'),
1844
2285
  with: [
1845
2286
  {
@@ -1854,6 +2295,7 @@ export class Runner {
1854
2295
  },
1855
2296
  {
1856
2297
  name: 'Download build artifacts',
2298
+ kind: 'artifact',
1857
2299
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1858
2300
  with: [
1859
2301
  {
@@ -1868,12 +2310,14 @@ export class Runner {
1868
2310
  },
1869
2311
  {
1870
2312
  name: 'Install Vercel CLI',
2313
+ kind: 'install',
1871
2314
  if: Runner.expr('env.PUBLISH == \'true\''),
1872
2315
  run: 'npm install -g vercel@latest',
1873
2316
  runPlain: true,
1874
2317
  },
1875
2318
  {
1876
2319
  name: 'Pull Vercel environment',
2320
+ kind: 'setup',
1877
2321
  if: Runner.expr('env.PUBLISH == \'true\''),
1878
2322
  env: [
1879
2323
  {
@@ -1896,6 +2340,7 @@ export class Runner {
1896
2340
  ];
1897
2341
  const deployStep = {
1898
2342
  name: 'Deploy to Vercel',
2343
+ kind: 'deploy',
1899
2344
  if: Runner.expr('env.PUBLISH == \'true\''),
1900
2345
  env: [
1901
2346
  {
@@ -1933,7 +2378,7 @@ export class Runner {
1933
2378
  id: `publish-vercel-nextjs-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1934
2379
  needs: context['needs'],
1935
2380
  runsOn: 'ubuntu-latest',
1936
- timeoutMinutes: 15,
2381
+ timeoutMinutes: context['timeoutMinutes'],
1937
2382
  permissions: {
1938
2383
  contents: 'read',
1939
2384
  },
@@ -2038,31 +2483,56 @@ export class Runner {
2038
2483
  ];
2039
2484
  return {
2040
2485
  name,
2486
+ kind: 'check',
2041
2487
  run: lines.join('\n'),
2042
2488
  runBlock: true,
2043
2489
  };
2044
2490
  }
2045
- static buildContainerArtifactSteps(platforms) {
2046
- const platformList = platforms.join(',');
2047
- return [
2048
- {
2049
- name: 'Set up QEMU',
2050
- uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
2051
- with: [{
2052
- key: 'platforms',
2053
- value: platformList,
2054
- }],
2055
- },
2056
- {
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({
2057
2526
  name: 'Set up Docker Buildx',
2527
+ kind: 'setup',
2058
2528
  uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
2059
- },
2060
- {
2529
+ }, {
2061
2530
  name: 'Prepare OCI handoff',
2531
+ kind: 'setup',
2062
2532
  run: 'mkdir -p "$RUNNER_TEMP/container-oci"',
2063
- },
2064
- {
2533
+ }, {
2065
2534
  name: 'Build immutable OCI artifact',
2535
+ kind: 'build',
2066
2536
  id: 'build-oci',
2067
2537
  uses: getScaffoldVersion('workflowActionDockerBuildPush'),
2068
2538
  with: [
@@ -2072,7 +2542,7 @@ export class Runner {
2072
2542
  },
2073
2543
  {
2074
2544
  key: 'platforms',
2075
- value: platformList,
2545
+ value: platform,
2076
2546
  },
2077
2547
  {
2078
2548
  key: 'push',
@@ -2086,24 +2556,36 @@ export class Runner {
2086
2556
  key: 'tags',
2087
2557
  value: 'nova.local/container:nova-oci',
2088
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
+ },
2089
2572
  {
2090
2573
  key: 'outputs',
2091
2574
  value: `type=oci,dest=${Runner.expr('runner.temp')}/container-oci/layout,tar=false`,
2092
2575
  },
2093
2576
  ],
2094
- },
2095
- {
2577
+ }, {
2096
2578
  name: 'Record OCI digest',
2579
+ kind: 'artifact',
2097
2580
  run: `printf '%s' '${Runner.expr('steps.build-oci.outputs.digest')}' > "$RUNNER_TEMP/container-oci/container-image.digest"`,
2098
- },
2099
- Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')),
2100
- {
2581
+ }, Runner.buildArtifactPreflightStep('Validate immutable OCI artifact', ['container-oci'], Runner.expr('runner.temp')), {
2101
2582
  name: 'Upload immutable OCI artifact',
2583
+ kind: 'artifact',
2102
2584
  uses: getScaffoldVersion('workflowActionUploadArtifact'),
2103
2585
  with: [
2104
2586
  {
2105
2587
  key: 'name',
2106
- value: 'container-oci',
2588
+ value: `container-oci-${platformSlug}`,
2107
2589
  },
2108
2590
  {
2109
2591
  key: 'retention-days',
@@ -2122,8 +2604,94 @@ export class Runner {
2122
2604
  value: `${Runner.expr('runner.temp')}/container-oci`,
2123
2605
  },
2124
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',
2125
2632
  },
2126
- ];
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;
2127
2695
  }
2128
2696
  static buildContainerRegistryTarget(context, config) {
2129
2697
  const registrySlug = config['registrySlug'];
@@ -2132,6 +2700,7 @@ export class Runner {
2132
2700
  const imageRepository = config['imageRepository'];
2133
2701
  const loginStep = config['loginStep'];
2134
2702
  const extraPermissions = config['extraPermissions'];
2703
+ const postAttestationSteps = config['postAttestationSteps'] ?? [];
2135
2704
  const resolveTagsRun = Runner.resolveContainerTagsRun();
2136
2705
  const checkImmutableTagsRun = Runner.checkImmutableContainerTagsRun();
2137
2706
  const pushRun = Runner.pushContainerArtifactRun();
@@ -2142,7 +2711,7 @@ export class Runner {
2142
2711
  id: `publish-${registrySlug}-root`,
2143
2712
  needs: context['needs'],
2144
2713
  runsOn: 'ubuntu-latest',
2145
- timeoutMinutes: 15,
2714
+ timeoutMinutes: context['timeoutMinutes'],
2146
2715
  permissions: {
2147
2716
  'contents': 'read',
2148
2717
  ...extraPermissions,
@@ -2153,6 +2722,7 @@ export class Runner {
2153
2722
  steps: [
2154
2723
  {
2155
2724
  name: 'Download immutable OCI artifact',
2725
+ kind: 'artifact',
2156
2726
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
2157
2727
  with: [
2158
2728
  {
@@ -2167,6 +2737,7 @@ export class Runner {
2167
2737
  },
2168
2738
  {
2169
2739
  name: 'Set up ORAS',
2740
+ kind: 'setup',
2170
2741
  uses: getScaffoldVersion('workflowActionSetupOras'),
2171
2742
  with: [{
2172
2743
  key: 'version',
@@ -2175,6 +2746,7 @@ export class Runner {
2175
2746
  },
2176
2747
  {
2177
2748
  name: 'Resolve image coordinate and tags',
2749
+ kind: 'setup',
2178
2750
  env: [
2179
2751
  {
2180
2752
  key: 'EVENT_NAME',
@@ -2231,30 +2803,35 @@ export class Runner {
2231
2803
  loginStep,
2232
2804
  {
2233
2805
  name: 'Reject conflicting immutable tags',
2806
+ kind: 'check',
2234
2807
  if: Runner.expr('env.PUBLISH == \'true\''),
2235
2808
  run: checkImmutableTagsRun,
2236
2809
  runBlock: true,
2237
2810
  },
2238
2811
  {
2239
2812
  name: 'Push immutable OCI artifact',
2813
+ kind: 'deploy',
2240
2814
  if: Runner.expr('env.PUBLISH == \'true\''),
2241
2815
  run: pushRun,
2242
2816
  runBlock: true,
2243
2817
  },
2244
2818
  {
2245
2819
  name: 'Apply image tags',
2820
+ kind: 'deploy',
2246
2821
  if: Runner.expr('env.PUBLISH == \'true\' && env.ADDITIONAL_TAGS != \'\''),
2247
2822
  run: tagRun,
2248
2823
  runBlock: true,
2249
2824
  },
2250
2825
  {
2251
2826
  name: 'Verify immutable image tags',
2827
+ kind: 'check',
2252
2828
  if: Runner.expr('env.PUBLISH == \'true\''),
2253
2829
  run: verifyRun,
2254
2830
  runBlock: true,
2255
2831
  },
2256
2832
  {
2257
2833
  name: 'Generate build provenance',
2834
+ kind: 'attest',
2258
2835
  if: Runner.expr('env.PUBLISH == \'true\''),
2259
2836
  uses: getScaffoldVersion('workflowActionAttest'),
2260
2837
  with: [
@@ -2272,8 +2849,10 @@ export class Runner {
2272
2849
  },
2273
2850
  ],
2274
2851
  },
2852
+ ...postAttestationSteps,
2275
2853
  {
2276
2854
  name: 'Publish latest channel',
2855
+ kind: 'deploy',
2277
2856
  if: Runner.expr('env.PUBLISH == \'true\' && env.PUBLISH_LATEST == \'true\''),
2278
2857
  run: 'oras tag "$IMAGE@$IMAGE_DIGEST" latest',
2279
2858
  },
@@ -2448,6 +3027,32 @@ export class Runner {
2448
3027
  'done',
2449
3028
  ].join('\n');
2450
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
+ }
2451
3056
  static pushContainerArtifactRun() {
2452
3057
  return 'oras cp --from-oci-layout "$RUNNER_TEMP/container-oci/layout@$(cat "$RUNNER_TEMP/container-oci/container-image.digest")" "$IMAGE:$SHA_TAG"';
2453
3058
  }
@@ -2637,7 +3242,7 @@ export class Runner {
2637
3242
  lines.push(`${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret list | jq -r '.[].name' | while read -r name; do`);
2638
3243
  lines.push(' case " $DECLARED " in');
2639
3244
  lines.push(' *" $name "*) ;;');
2640
- lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name" --force ;;`);
3245
+ lines.push(` *) echo "Removing undeclared secret: $name"; ${Runner.corepackExecuteCommand(packageManager, 'wrangler')} secret delete "$name" < /dev/null ;;`);
2641
3246
  lines.push(' esac');
2642
3247
  lines.push('done');
2643
3248
  lines.push('echo "Syncing declared secrets: $DECLARED"');
@@ -2681,6 +3286,7 @@ export class Runner {
2681
3286
  const run = lines.join('\n');
2682
3287
  return {
2683
3288
  name: (vendor === 'cloudflare') ? 'Sync worker runtime secrets' : 'Sync Vercel runtime environment',
3289
+ kind: 'deploy',
2684
3290
  if: Runner.expr('env.PUBLISH == \'true\''),
2685
3291
  env,
2686
3292
  run,
@@ -2916,7 +3522,7 @@ export class Runner {
2916
3522
  }
2917
3523
  return lines;
2918
3524
  }
2919
- static serializeJobs(jobs) {
3525
+ static serializeJobs(jobs, stepTimeoutMinutes) {
2920
3526
  const lines = [];
2921
3527
  lines.push('jobs:');
2922
3528
  for (const job of jobs) {
@@ -2952,6 +3558,15 @@ export class Runner {
2952
3558
  if (stepUses !== undefined) {
2953
3559
  lines.push(` uses: ${Runner.quote(stepUses)}`);
2954
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
+ }
2955
3570
  const stepEnv = step['env'];
2956
3571
  const isEnvAfterRun = step['envAfterRun'] === true;
2957
3572
  if (stepEnv !== undefined && isEnvAfterRun === false) {