@cbnventures/nova 0.37.2 → 0.38.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 (105) hide show
  1. package/build/package.json +1 -1
  2. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
  3. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  4. package/build/src/cli/generate/github/workflows-blueprint-validate.js +17 -1
  5. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  6. package/build/src/cli/generate/github/workflows-blueprint.d.ts +3 -3
  7. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  8. package/build/src/cli/generate/github/workflows-blueprint.js +124 -59
  9. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  10. package/build/src/cli/index.js +1 -0
  11. package/build/src/cli/index.js.map +1 -1
  12. package/build/src/cli/scaffold/app/astro.d.ts.map +1 -1
  13. package/build/src/cli/scaffold/app/astro.js +8 -0
  14. package/build/src/cli/scaffold/app/astro.js.map +1 -1
  15. package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
  16. package/build/src/cli/scaffold/app/discord-bot.js +28 -0
  17. package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
  18. package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
  19. package/build/src/cli/scaffold/app/expressjs.js +28 -0
  20. package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
  21. package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
  22. package/build/src/cli/scaffold/app/nextjs.js +22 -0
  23. package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
  24. package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
  25. package/build/src/cli/scaffold/app/vite.js +8 -0
  26. package/build/src/cli/scaffold/app/vite.js.map +1 -1
  27. package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
  28. package/build/src/cli/scaffold/docs/docusaurus.js +8 -0
  29. package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
  30. package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
  31. package/build/src/cli/scaffold/package/github-action.js +14 -0
  32. package/build/src/cli/scaffold/package/github-action.js.map +1 -1
  33. package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
  34. package/build/src/cli/scaffold/package/homebridge.js +22 -0
  35. package/build/src/cli/scaffold/package/homebridge.js.map +1 -1
  36. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  37. package/build/src/cli/scaffold/package/pfsense.js +8 -0
  38. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  39. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  40. package/build/src/cli/scaffold/tool/serverless.js +51 -0
  41. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  42. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  43. package/build/src/cli/utility/changelog.js +2 -0
  44. package/build/src/cli/utility/changelog.js.map +1 -1
  45. package/build/src/cli/utility/configure.d.ts +4 -1
  46. package/build/src/cli/utility/configure.d.ts.map +1 -1
  47. package/build/src/cli/utility/configure.js +82 -0
  48. package/build/src/cli/utility/configure.js.map +1 -1
  49. package/build/src/cli/utility/run-workspaces.d.ts.map +1 -1
  50. package/build/src/cli/utility/run-workspaces.js +1 -0
  51. package/build/src/cli/utility/run-workspaces.js.map +1 -1
  52. package/build/src/lib/artifact-assembly.d.ts +7 -0
  53. package/build/src/lib/artifact-assembly.d.ts.map +1 -0
  54. package/build/src/lib/artifact-assembly.js +122 -0
  55. package/build/src/lib/artifact-assembly.js.map +1 -0
  56. package/build/src/lib/docker-packaging.d.ts +2 -1
  57. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  58. package/build/src/lib/docker-packaging.js +44 -0
  59. package/build/src/lib/docker-packaging.js.map +1 -1
  60. package/build/src/lib/nova-config-order.d.ts.map +1 -1
  61. package/build/src/lib/nova-config-order.js +1 -0
  62. package/build/src/lib/nova-config-order.js.map +1 -1
  63. package/build/src/lib/nova-config.d.ts +1 -0
  64. package/build/src/lib/nova-config.d.ts.map +1 -1
  65. package/build/src/lib/nova-config.js +104 -2
  66. package/build/src/lib/nova-config.js.map +1 -1
  67. package/build/src/lib/run-workspaces.d.ts.map +1 -1
  68. package/build/src/lib/run-workspaces.js +79 -8
  69. package/build/src/lib/run-workspaces.js.map +1 -1
  70. package/build/src/lib/scaffold.d.ts +2 -2
  71. package/build/src/lib/scaffold.d.ts.map +1 -1
  72. package/build/src/lib/scaffold.js +31 -2
  73. package/build/src/lib/scaffold.js.map +1 -1
  74. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +7 -0
  75. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +46 -2
  76. package/build/src/types/cli/utility/configure.d.ts +58 -0
  77. package/build/src/types/lib/artifact-assembly.d.ts +102 -0
  78. package/build/src/types/lib/docker-packaging.d.ts +29 -0
  79. package/build/src/types/lib/nova-config.d.ts +67 -2
  80. package/build/src/types/lib/run-workspaces.d.ts +30 -0
  81. package/build/src/types/lib/scaffold.d.ts +19 -0
  82. package/build/src/types/shared.d.ts +74 -1
  83. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +23 -0
  84. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +16 -0
  85. package/build/src/types/tests/cli/scaffold/app/nextjs.test.d.ts +6 -0
  86. package/build/src/types/tests/cli/utility/configure.test.d.ts +1 -0
  87. package/build/src/types/tests/cli/utility/run-workspaces.test.d.ts +29 -2
  88. package/build/src/types/tests/lib/artifact-assembly.test.d.ts +45 -0
  89. package/build/src/types/tests/lib/docker-packaging.test.d.ts +12 -0
  90. package/build/src/types/tests/lib/nova-config-artifacts.test.d.ts +40 -0
  91. package/build/templates/generators/must-haves/agent-conventions/conventions/nova.md +7 -1
  92. package/build/templates/scaffold/app/android/package.json +1 -1
  93. package/build/templates/scaffold/app/apple/package.json +1 -1
  94. package/build/templates/scaffold/app/astro/package.json +1 -1
  95. package/build/templates/scaffold/app/discord-bot/package.json +1 -1
  96. package/build/templates/scaffold/app/express/package.json +1 -1
  97. package/build/templates/scaffold/app/nextjs/package.json +1 -1
  98. package/build/templates/scaffold/app/vite/package.json +1 -1
  99. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  100. package/build/templates/scaffold/package/github-action/package.json +1 -1
  101. package/build/templates/scaffold/package/homebridge/package.json +1 -1
  102. package/build/templates/scaffold/package/pfsense/package.json +1 -1
  103. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
  104. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +1 -1
  105. package/package.json +1 -1
@@ -35,6 +35,7 @@ export class Runner {
35
35
  }
36
36
  const config = await new LibNovaConfig().load();
37
37
  const workspaces = config['workspaces'] ?? {};
38
+ const artifacts = config['artifacts'] ?? {};
38
39
  const environment = config['environment'] ?? {};
39
40
  const configPath = join(currentDirectory, 'nova.config.json');
40
41
  let rawConfig = {};
@@ -58,7 +59,7 @@ export class Runner {
58
59
  }).info('No workflows configured.');
59
60
  return 'completed';
60
61
  }
61
- const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy'], environment);
62
+ const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy'], environment, artifacts);
62
63
  const validatedWorkflows = validation['workflows'];
63
64
  for (const diagnosticEntry of validation['diagnostics']) {
64
65
  const diagnostic = diagnosticEntry;
@@ -106,7 +107,7 @@ export class Runner {
106
107
  const template = entry['template'];
107
108
  const suffix = entry['name'];
108
109
  const outputFileName = (suffix !== undefined) ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
109
- const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager);
110
+ const serialized = Runner.dispatch(entry, workspaces, environment, validatedWorkflows, packageManager, artifacts);
110
111
  const entrySetupLines = Variables.collectSetupLines(entry, outputFileName, environment);
111
112
  generatedSet.add(outputFileName);
112
113
  setupLines.push(...entrySetupLines);
@@ -171,7 +172,7 @@ export class Runner {
171
172
  }
172
173
  return 'completed';
173
174
  }
174
- static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm') {
175
+ static dispatch(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
175
176
  const template = entry['template'];
176
177
  let workflow = undefined;
177
178
  if (template === 'check-sponsor-gated-issues') {
@@ -181,7 +182,7 @@ export class Runner {
181
182
  workflow = Runner.buildLockInactiveIssues(entry, environment);
182
183
  }
183
184
  else {
184
- workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager);
185
+ workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager, artifacts);
185
186
  }
186
187
  const runsOn = entry['runsOn'];
187
188
  const timeoutMinutes = entry['timeoutMinutes'];
@@ -469,7 +470,7 @@ export class Runner {
469
470
  jobs: [job],
470
471
  };
471
472
  }
472
- static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm') {
473
+ static buildPublish(entry, workspaces, environment = {}, siblings = [], packageManager = 'npm', artifacts = {}) {
473
474
  const suffix = entry['name'];
474
475
  const workflowId = Runner.resolveWorkflowId(suffix);
475
476
  const on = [];
@@ -642,12 +643,28 @@ export class Runner {
642
643
  },
643
644
  ];
644
645
  const scopes = entry['build'] ?? [];
645
- const names = scopes.map((scope) => {
646
- const workspace = workspaces[scope];
647
- return workspace['name'];
648
- });
649
- const checkCommand = Runner.buildScopeCommand('check', names, packageManager);
650
- const buildCommand = Runner.buildScopeCommand('build', names, packageManager);
646
+ const artifactNames = [...new Set(targets.flatMap((target) => (target['artifact'] === undefined) ? [] : [target['artifact']]))];
647
+ const artifactWorkspaceNames = [];
648
+ for (const artifactName of artifactNames) {
649
+ const artifact = artifacts[artifactName];
650
+ if (artifact === undefined) {
651
+ continue;
652
+ }
653
+ for (const artifactScopeValue of artifact['build']) {
654
+ const artifactScope = artifactScopeValue;
655
+ const artifactWorkspace = workspaces[artifactScope];
656
+ artifactWorkspaceNames.push(artifactWorkspace['name']);
657
+ }
658
+ }
659
+ const names = [...new Set([
660
+ ...artifactWorkspaceNames,
661
+ ...scopes.map((scope) => {
662
+ const scopeWorkspace = workspaces[scope];
663
+ return scopeWorkspace['name'];
664
+ }),
665
+ ])];
666
+ const checkCommand = Runner.buildScopeCommand('check', names, [], packageManager);
667
+ const buildCommand = Runner.buildScopeCommand('build', names, artifactNames, packageManager);
651
668
  const steps = [
652
669
  {
653
670
  name: 'Checkout repository',
@@ -741,24 +758,35 @@ export class Runner {
741
758
  }
742
759
  const artifactPreflightPaths = [];
743
760
  const artifactUploadSteps = [];
761
+ const seenArtifactNames = new Set();
744
762
  for (const target of targets) {
745
763
  const uploadTarget = target;
764
+ const uploadConfiguredArtifactName = uploadTarget['artifact'];
765
+ if (uploadConfiguredArtifactName !== undefined && seenArtifactNames.has(uploadConfiguredArtifactName) === true) {
766
+ continue;
767
+ }
746
768
  const uploadMetadata = Variables.getTargetMetadata('publish', uploadTarget['to']);
747
- const uploadArtifactPaths = (uploadMetadata === undefined) ? ['{workingDir}/build'] : uploadMetadata['artifactPaths'];
769
+ let uploadArtifactPaths = [`build/${uploadConfiguredArtifactName}`];
770
+ if (uploadConfiguredArtifactName === undefined) {
771
+ uploadArtifactPaths = ['{workingDir}/build'];
772
+ if (uploadMetadata !== undefined) {
773
+ uploadArtifactPaths = uploadMetadata['artifactPaths'];
774
+ }
775
+ }
748
776
  if (uploadArtifactPaths.length === 0) {
749
777
  continue;
750
778
  }
751
779
  const uploadWorkingDir = (uploadTarget['path'] === './') ? '.' : uploadTarget['path'].replace(LIB_REGEX_PATTERN_LEADING_DOT_SLASH, '');
752
780
  const uploadResolvedArtifactPaths = uploadArtifactPaths.map((artifactPath) => artifactPath.replace('{workingDir}', uploadWorkingDir));
753
781
  const uploadPath = uploadResolvedArtifactPaths.join('\n');
754
- const artifactName = `build-${uploadTarget['to']}-${Runner.slugifyWorkingDir(uploadTarget['path'])}`;
782
+ const uploadArtifactName = (uploadConfiguredArtifactName === undefined) ? `build-${uploadTarget['to']}-${Runner.slugifyWorkingDir(uploadTarget['path'])}` : `artifact-${uploadConfiguredArtifactName}`;
755
783
  const uploadStep = {
756
- name: `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})`,
784
+ name: (uploadConfiguredArtifactName === undefined) ? `Upload build artifacts (${uploadTarget['to']}/${Runner.slugifyWorkingDir(uploadTarget['path'])})` : `Upload assembled artifact (${uploadConfiguredArtifactName})`,
757
785
  uses: getScaffoldVersion('workflowActionUploadArtifact'),
758
786
  with: [
759
787
  {
760
788
  key: 'name',
761
- value: artifactName,
789
+ value: uploadArtifactName,
762
790
  },
763
791
  {
764
792
  key: 'retention-days',
@@ -785,6 +813,9 @@ export class Runner {
785
813
  }
786
814
  }
787
815
  artifactUploadSteps.push(uploadStep);
816
+ if (uploadConfiguredArtifactName !== undefined) {
817
+ seenArtifactNames.add(uploadConfiguredArtifactName);
818
+ }
788
819
  }
789
820
  if (artifactPreflightPaths.length > 0) {
790
821
  steps.push(Runner.buildArtifactPreflightStep('Validate build artifacts', artifactPreflightPaths, Runner.expr('github.workspace')), ...artifactUploadSteps);
@@ -807,9 +838,18 @@ export class Runner {
807
838
  const deployTarget = target;
808
839
  const targetSettings = deployTarget['with'];
809
840
  const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
841
+ const deployConfiguredArtifactName = deployTarget['artifact'];
842
+ let deployArtifactName = `artifact-${deployConfiguredArtifactName}`;
843
+ if (isContainerTarget === true) {
844
+ deployArtifactName = 'container-oci';
845
+ }
846
+ else if (deployConfiguredArtifactName === undefined) {
847
+ deployArtifactName = `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`;
848
+ }
810
849
  const context = {
811
850
  workingDir: deployTarget['path'],
812
- artifactName: (isContainerTarget === true) ? 'container-oci' : `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`,
851
+ artifactName: deployArtifactName,
852
+ ...((deployConfiguredArtifactName === undefined) ? {} : { artifactDirectory: `build/${deployConfiguredArtifactName}` }),
813
853
  needs: (isContainerTarget === true) ? ['build'] : Runner.resolveDeployNeeds(deployTarget),
814
854
  targetSettings,
815
855
  workflowSettings,
@@ -1073,6 +1113,7 @@ export class Runner {
1073
1113
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1074
1114
  const environment = context['environment'];
1075
1115
  const appPath = context['workingDir'];
1116
+ const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
1076
1117
  return {
1077
1118
  id: `publish-npm-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1078
1119
  needs: context['needs'],
@@ -1119,7 +1160,7 @@ export class Runner {
1119
1160
  },
1120
1161
  {
1121
1162
  key: 'path',
1122
- value: `${context['workingDir']}/build`,
1163
+ value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
1123
1164
  },
1124
1165
  ],
1125
1166
  },
@@ -1134,7 +1175,7 @@ export class Runner {
1134
1175
  {
1135
1176
  name: 'Publish package to npm',
1136
1177
  run: Runner.npmPublishRun(),
1137
- workingDirectory: context['workingDir'],
1178
+ workingDirectory: deployDirectory,
1138
1179
  },
1139
1180
  ],
1140
1181
  };
@@ -1144,6 +1185,7 @@ export class Runner {
1144
1185
  const workflowSettings = context['workflowSettings'];
1145
1186
  const metadata = Variables.getTargetMetadata('publish', 'github-packages');
1146
1187
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1188
+ const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
1147
1189
  return {
1148
1190
  id: `publish-github-packages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1149
1191
  needs: context['needs'],
@@ -1209,14 +1251,14 @@ export class Runner {
1209
1251
  },
1210
1252
  {
1211
1253
  key: 'path',
1212
- value: `${context['workingDir']}/build`,
1254
+ value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
1213
1255
  },
1214
1256
  ],
1215
1257
  },
1216
1258
  {
1217
1259
  name: 'Change to scoped package name',
1218
1260
  run: Runner.scopePackageNameRun(),
1219
- workingDirectory: context['workingDir'],
1261
+ workingDirectory: deployDirectory,
1220
1262
  },
1221
1263
  {
1222
1264
  name: 'Configure authentication',
@@ -1229,14 +1271,14 @@ export class Runner {
1229
1271
  {
1230
1272
  name: 'Publish package to GitHub Packages',
1231
1273
  run: Runner.githubPublishRun(),
1232
- workingDirectory: context['workingDir'],
1274
+ workingDirectory: deployDirectory,
1233
1275
  },
1234
1276
  {
1235
1277
  name: 'Restore package name',
1236
1278
  if: Runner.expr('always() && env.PACKAGE_NAME'),
1237
1279
  run: 'npm pkg set name="$PACKAGE_NAME"',
1238
1280
  runBlock: true,
1239
- workingDirectory: context['workingDir'],
1281
+ workingDirectory: deployDirectory,
1240
1282
  },
1241
1283
  ],
1242
1284
  };
@@ -1248,6 +1290,7 @@ export class Runner {
1248
1290
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1249
1291
  const environment = context['environment'];
1250
1292
  const appPath = context['workingDir'];
1293
+ const deployDirectory = context['artifactDirectory'] ?? `${context['workingDir']}/build`;
1251
1294
  return {
1252
1295
  id: `publish-cloudflare-pages-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1253
1296
  needs: context['needs'],
@@ -1289,7 +1332,7 @@ export class Runner {
1289
1332
  },
1290
1333
  {
1291
1334
  key: 'path',
1292
- value: `${context['workingDir']}/build`,
1335
+ value: deployDirectory,
1293
1336
  },
1294
1337
  ],
1295
1338
  },
@@ -1314,7 +1357,7 @@ export class Runner {
1314
1357
  value: Runner.expr('github.event.repository.default_branch'),
1315
1358
  },
1316
1359
  ],
1317
- run: Runner.corepackDownloadCommand(context['packageManager'], 'wrangler@3', `pages deploy ${context['workingDir']}/build --project-name="$CLOUDFLARE_PROJECT_NAME" --branch="$DEFAULT_BRANCH"`),
1360
+ run: Runner.corepackDownloadCommand(context['packageManager'], 'wrangler@3', `pages deploy ${deployDirectory} --project-name="$CLOUDFLARE_PROJECT_NAME" --branch="$DEFAULT_BRANCH"`),
1318
1361
  },
1319
1362
  ],
1320
1363
  };
@@ -1328,6 +1371,7 @@ export class Runner {
1328
1371
  const environmentSelection = context['environmentSelection'];
1329
1372
  const profileAware = environmentSelection !== undefined;
1330
1373
  const appPath = context['workingDir'];
1374
+ const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
1331
1375
  const runtimeValues = Runner.appRuntimeValues(environment, appPath, profileAware);
1332
1376
  const deployEnv = [
1333
1377
  {
@@ -1374,7 +1418,7 @@ export class Runner {
1374
1418
  },
1375
1419
  {
1376
1420
  key: 'path',
1377
- value: `${context['workingDir']}/build`,
1421
+ value: context['artifactDirectory'] ?? `${context['workingDir']}/build`,
1378
1422
  },
1379
1423
  ],
1380
1424
  },
@@ -1383,7 +1427,7 @@ export class Runner {
1383
1427
  if: Runner.expr('env.PUBLISH == \'true\''),
1384
1428
  env: deployEnv,
1385
1429
  run: deployRun,
1386
- workingDirectory: context['workingDir'],
1430
+ workingDirectory: deployDirectory,
1387
1431
  },
1388
1432
  ];
1389
1433
  const environmentSelectionStep = Runner.buildCloudflareEnvironmentSelectionStep(environmentSelection);
@@ -1393,7 +1437,7 @@ export class Runner {
1393
1437
  const syncStep = Runner.emitRuntimeSyncStep({
1394
1438
  vendor: 'cloudflare',
1395
1439
  runtimeValues,
1396
- workingDir: context['workingDir'],
1440
+ workingDir: deployDirectory,
1397
1441
  packageManager: context['packageManager'],
1398
1442
  extraEnv: [
1399
1443
  {
@@ -1492,6 +1536,7 @@ export class Runner {
1492
1536
  const workflowSettings = context['workflowSettings'];
1493
1537
  const metadata = Variables.getTargetMetadata('publish', 'github-pages');
1494
1538
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1539
+ const deployDirectory = context['artifactDirectory'] ?? `${context['workingDir']}/build`;
1495
1540
  const pagesStatusRun = [
1496
1541
  `if gh api "repos/${Runner.expr('github.repository')}/pages" > /dev/null 2>&1; then`,
1497
1542
  ' echo "[Pages] GitHub Pages is enabled."',
@@ -1526,7 +1571,7 @@ export class Runner {
1526
1571
  },
1527
1572
  {
1528
1573
  key: 'path',
1529
- value: `${context['workingDir']}/build`,
1574
+ value: deployDirectory,
1530
1575
  },
1531
1576
  ],
1532
1577
  },
@@ -1550,7 +1595,7 @@ export class Runner {
1550
1595
  uses: getScaffoldVersion('workflowActionUploadPagesArtifact'),
1551
1596
  with: [{
1552
1597
  key: 'path',
1553
- value: `${context['workingDir']}/build`,
1598
+ value: deployDirectory,
1554
1599
  }],
1555
1600
  },
1556
1601
  {
@@ -1575,6 +1620,7 @@ export class Runner {
1575
1620
  const actionYmlPath = Runner.resolveVariableExpr(variables, 'ACTION_YML_PATH', targetSettings, workflowSettings);
1576
1621
  const releaseBranchName = Runner.resolveVariableExpr(variables, 'RELEASE_BRANCH_NAME', targetSettings, workflowSettings);
1577
1622
  const workspaceDir = context['workingDir'];
1623
+ const deployDirectory = context['artifactDirectory'] ?? actionOutputPath;
1578
1624
  const configureGitIdentityRun = [
1579
1625
  'set -euo pipefail',
1580
1626
  'git config --global user.name "github-actions[bot]"',
@@ -1611,31 +1657,39 @@ export class Runner {
1611
1657
  ' git rm -rf . > /dev/null 2>&1 || true',
1612
1658
  'fi',
1613
1659
  ].join('\n');
1614
- const stageReleaseTreeRun = [
1660
+ let stageReleaseTreeRun = [
1615
1661
  'set -euo pipefail',
1616
1662
  'cd "$GITHUB_WORKSPACE"',
1617
1663
  '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',
1664
+ `cp -R "${deployDirectory}/." "$STAGE/"`,
1638
1665
  ].join('\n');
1666
+ if (context['artifactDirectory'] === undefined) {
1667
+ stageReleaseTreeRun = [
1668
+ 'set -euo pipefail',
1669
+ 'cd "$GITHUB_WORKSPACE"',
1670
+ 'STAGE="$RUNNER_TEMP/release"',
1671
+ '',
1672
+ '# Required: action.yml and the built action directory.',
1673
+ `cp "${actionYmlPath}" "$STAGE/action.yml"`,
1674
+ 'mkdir -p "$STAGE/action"',
1675
+ `cp -R "${actionOutputPath}/." "$STAGE/action/"`,
1676
+ '',
1677
+ '# Repoint action.yml at the bundled entry in the flattened release tree. The',
1678
+ '# source action.yml resolves runs.main against the working layout; the published',
1679
+ '# tree carries only action.yml plus the bundle under action/, so runs.main must',
1680
+ '# resolve there instead. Only the main key inside the runs block is rewritten.',
1681
+ `sed -i -E '/^runs:/,$ s#^([[:space:]]+main:[[:space:]]*).*#\\1"action/${actionEntryPoint}"#' "$STAGE/action.yml"`,
1682
+ '',
1683
+ '# Optional: common community-repo files. Prefer workspace-level over root.',
1684
+ 'for optional in README.md LICENSE SECURITY.md NOTICE CHANGELOG.md; do',
1685
+ ` if [ -f "${workspaceDir}/$optional" ]; then`,
1686
+ ` cp "${workspaceDir}/$optional" "$STAGE/$optional"`,
1687
+ ' elif [ -f "$optional" ]; then',
1688
+ ' cp "$optional" "$STAGE/$optional"',
1689
+ ' fi',
1690
+ 'done',
1691
+ ].join('\n');
1692
+ }
1639
1693
  const commitAndPushReleaseRun = [
1640
1694
  'set -euo pipefail',
1641
1695
  'cd "$RUNNER_TEMP/release"',
@@ -1695,7 +1749,7 @@ export class Runner {
1695
1749
  },
1696
1750
  {
1697
1751
  key: 'path',
1698
- value: actionOutputPath,
1752
+ value: deployDirectory,
1699
1753
  },
1700
1754
  ],
1701
1755
  },
@@ -1763,7 +1817,7 @@ export class Runner {
1763
1817
  uses: getScaffoldVersion('workflowActionAttest'),
1764
1818
  with: [{
1765
1819
  key: 'subject-path',
1766
- value: `${actionOutputPath}/${actionEntryPoint}`,
1820
+ value: (context['artifactDirectory'] === undefined) ? `${actionOutputPath}/${actionEntryPoint}` : `${deployDirectory}/action/${actionEntryPoint}`,
1767
1821
  }],
1768
1822
  },
1769
1823
  ],
@@ -1776,6 +1830,7 @@ export class Runner {
1776
1830
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1777
1831
  const environment = context['environment'];
1778
1832
  const appPath = context['workingDir'];
1833
+ const deployDirectory = context['artifactDirectory'] ?? context['workingDir'];
1779
1834
  const dollar = Runner.dollar();
1780
1835
  const runtimeValues = Runner.appRuntimeValues(environment, appPath);
1781
1836
  const steps = [
@@ -1800,10 +1855,16 @@ export class Runner {
1800
1855
  {
1801
1856
  name: 'Download build artifacts',
1802
1857
  uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1803
- with: [{
1858
+ with: [
1859
+ {
1804
1860
  key: 'name',
1805
1861
  value: context['artifactName'],
1806
- }],
1862
+ },
1863
+ ...((context['artifactDirectory'] === undefined) ? [] : [{
1864
+ key: 'path',
1865
+ value: context['artifactDirectory'],
1866
+ }]),
1867
+ ],
1807
1868
  },
1808
1869
  {
1809
1870
  name: 'Install Vercel CLI',
@@ -1830,7 +1891,7 @@ export class Runner {
1830
1891
  ],
1831
1892
  run: `vercel pull --yes --environment=production --token="${dollar}VERCEL_TOKEN}"`,
1832
1893
  runBlock: true,
1833
- workingDirectory: context['workingDir'],
1894
+ workingDirectory: deployDirectory,
1834
1895
  },
1835
1896
  ];
1836
1897
  const deployStep = {
@@ -1852,12 +1913,12 @@ export class Runner {
1852
1913
  ],
1853
1914
  run: `vercel deploy --prebuilt --prod --token="${dollar}VERCEL_TOKEN}"`,
1854
1915
  runBlock: true,
1855
- workingDirectory: context['workingDir'],
1916
+ workingDirectory: deployDirectory,
1856
1917
  };
1857
1918
  const syncStep = Runner.emitRuntimeSyncStep({
1858
1919
  vendor: 'vercel',
1859
1920
  runtimeValues,
1860
- workingDir: context['workingDir'],
1921
+ workingDir: deployDirectory,
1861
1922
  packageManager: context['packageManager'],
1862
1923
  extraEnv: [{
1863
1924
  key: 'VERCEL_TOKEN',
@@ -2418,10 +2479,14 @@ export class Runner {
2418
2479
  'echo "IMAGE_DIGEST=$expected_digest" >> "$GITHUB_ENV"',
2419
2480
  ].join('\n');
2420
2481
  }
2421
- static buildScopeCommand(scriptName, workspaceNames, packageManager) {
2482
+ static buildScopeCommand(scriptName, workspaceNames, artifactNames, packageManager) {
2422
2483
  const selectedNames = (workspaceNames.length > 0) ? workspaceNames : ['./'];
2423
2484
  const workspaceFlags = selectedNames.map((workspaceName) => `--workspace ${workspaceName}`).join(' ');
2424
- return `${packageManager} run ${scriptName} -- ${workspaceFlags}`;
2485
+ const artifactFlags = artifactNames.map((artifactName) => `--artifact ${artifactName}`).join(' ');
2486
+ if (artifactFlags.length === 0) {
2487
+ return `${packageManager} run ${scriptName} -- ${workspaceFlags}`;
2488
+ }
2489
+ return `${packageManager} run ${scriptName} -- ${workspaceFlags} ${artifactFlags}`;
2425
2490
  }
2426
2491
  static corepackBootstrapRun(packageManager) {
2427
2492
  const corepackVersion = getScaffoldVersion('corepack');