@cbnventures/nova 0.33.0 → 0.34.1

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 (271) hide show
  1. package/bin/nova.mjs +5 -2
  2. package/build/package.json +3 -2
  3. package/build/scaffold-versions.json +21 -14
  4. package/build/src/api/app-store-connect.d.ts +28 -0
  5. package/build/src/api/app-store-connect.d.ts.map +1 -0
  6. package/build/src/api/app-store-connect.js +494 -0
  7. package/build/src/api/app-store-connect.js.map +1 -0
  8. package/build/src/api/google-play-console.d.ts +15 -0
  9. package/build/src/api/google-play-console.d.ts.map +1 -0
  10. package/build/src/api/google-play-console.js +136 -0
  11. package/build/src/api/google-play-console.js.map +1 -0
  12. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +4 -2
  13. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  14. package/build/src/cli/generate/github/workflows-blueprint-validate.js +199 -3
  15. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  16. package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -0
  17. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  18. package/build/src/cli/generate/github/workflows-blueprint.js +458 -59
  19. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  20. package/build/src/cli/index.js +154 -0
  21. package/build/src/cli/index.js.map +1 -1
  22. package/build/src/cli/integration/app-store-connect.d.ts +22 -0
  23. package/build/src/cli/integration/app-store-connect.d.ts.map +1 -0
  24. package/build/src/cli/integration/app-store-connect.js +502 -0
  25. package/build/src/cli/integration/app-store-connect.js.map +1 -0
  26. package/build/src/cli/integration/discord-developer-portal.d.ts +6 -0
  27. package/build/src/cli/integration/discord-developer-portal.d.ts.map +1 -0
  28. package/build/src/cli/integration/discord-developer-portal.js +42 -0
  29. package/build/src/cli/integration/discord-developer-portal.js.map +1 -0
  30. package/build/src/cli/integration/google-play-console.d.ts +16 -0
  31. package/build/src/cli/integration/google-play-console.d.ts.map +1 -0
  32. package/build/src/cli/integration/google-play-console.js +199 -0
  33. package/build/src/cli/integration/google-play-console.js.map +1 -0
  34. package/build/src/cli/integration/index.d.ts +8 -0
  35. package/build/src/cli/integration/index.d.ts.map +1 -0
  36. package/build/src/cli/integration/index.js +139 -0
  37. package/build/src/cli/integration/index.js.map +1 -0
  38. package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
  39. package/build/src/cli/recipe/package-json/normalize-tooling.js +47 -3
  40. package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
  41. package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
  42. package/build/src/cli/recipe/package-json/sync-identity.js +51 -18
  43. package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
  44. package/build/src/cli/scaffold/app/android.d.ts.map +1 -1
  45. package/build/src/cli/scaffold/app/android.js +2 -0
  46. package/build/src/cli/scaffold/app/android.js.map +1 -1
  47. package/build/src/cli/scaffold/app/apple.d.ts.map +1 -1
  48. package/build/src/cli/scaffold/app/apple.js +2 -0
  49. package/build/src/cli/scaffold/app/apple.js.map +1 -1
  50. package/build/src/cli/scaffold/app/astro.d.ts.map +1 -1
  51. package/build/src/cli/scaffold/app/astro.js +10 -0
  52. package/build/src/cli/scaffold/app/astro.js.map +1 -1
  53. package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
  54. package/build/src/cli/scaffold/app/discord-bot.js +11 -1
  55. package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
  56. package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
  57. package/build/src/cli/scaffold/app/expressjs.js +11 -1
  58. package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
  59. package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
  60. package/build/src/cli/scaffold/app/nextjs.js +4 -1
  61. package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
  62. package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
  63. package/build/src/cli/scaffold/app/vite.js +10 -1
  64. package/build/src/cli/scaffold/app/vite.js.map +1 -1
  65. package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
  66. package/build/src/cli/scaffold/docs/docusaurus.js +8 -2
  67. package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
  68. package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
  69. package/build/src/cli/scaffold/package/github-action.js +4 -0
  70. package/build/src/cli/scaffold/package/github-action.js.map +1 -1
  71. package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
  72. package/build/src/cli/scaffold/package/homebridge.js +1 -0
  73. package/build/src/cli/scaffold/package/homebridge.js.map +1 -1
  74. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  75. package/build/src/cli/scaffold/package/pfsense.js +1 -0
  76. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  77. package/build/src/cli/scaffold/starter/base.d.ts.map +1 -1
  78. package/build/src/cli/scaffold/starter/base.js +2 -1
  79. package/build/src/cli/scaffold/starter/base.js.map +1 -1
  80. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  81. package/build/src/cli/scaffold/tool/serverless.js +5 -0
  82. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  83. package/build/src/cli/utility/changelog.d.ts +2 -0
  84. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  85. package/build/src/cli/utility/changelog.js +225 -129
  86. package/build/src/cli/utility/changelog.js.map +1 -1
  87. package/build/src/cli/utility/configure.d.ts.map +1 -1
  88. package/build/src/cli/utility/configure.js +251 -42
  89. package/build/src/cli/utility/configure.js.map +1 -1
  90. package/build/src/lib/docker-packaging.d.ts +22 -1
  91. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  92. package/build/src/lib/docker-packaging.js +1048 -76
  93. package/build/src/lib/docker-packaging.js.map +1 -1
  94. package/build/src/lib/file-discovery.js +1 -1
  95. package/build/src/lib/file-discovery.js.map +1 -1
  96. package/build/src/lib/ignore-files.d.ts.map +1 -1
  97. package/build/src/lib/ignore-files.js +4 -1
  98. package/build/src/lib/ignore-files.js.map +1 -1
  99. package/build/src/lib/integration.d.ts +14 -0
  100. package/build/src/lib/integration.d.ts.map +1 -0
  101. package/build/src/lib/integration.js +323 -0
  102. package/build/src/lib/integration.js.map +1 -0
  103. package/build/src/lib/nova-config.d.ts.map +1 -1
  104. package/build/src/lib/nova-config.js +22 -3
  105. package/build/src/lib/nova-config.js.map +1 -1
  106. package/build/src/lib/package-scripts.d.ts.map +1 -1
  107. package/build/src/lib/package-scripts.js +2 -1
  108. package/build/src/lib/package-scripts.js.map +1 -1
  109. package/build/src/lib/regex.d.ts +8 -0
  110. package/build/src/lib/regex.d.ts.map +1 -1
  111. package/build/src/lib/regex.js +10 -2
  112. package/build/src/lib/regex.js.map +1 -1
  113. package/build/src/lib/release-history.d.ts +2 -1
  114. package/build/src/lib/release-history.d.ts.map +1 -1
  115. package/build/src/lib/release-history.js +18 -0
  116. package/build/src/lib/release-history.js.map +1 -1
  117. package/build/src/lib/run-workspaces.d.ts +2 -0
  118. package/build/src/lib/run-workspaces.d.ts.map +1 -1
  119. package/build/src/lib/run-workspaces.js +121 -1
  120. package/build/src/lib/run-workspaces.js.map +1 -1
  121. package/build/src/lib/scaffold-allow-scripts.d.ts +4 -0
  122. package/build/src/lib/scaffold-allow-scripts.d.ts.map +1 -0
  123. package/build/src/lib/scaffold-allow-scripts.js +76 -0
  124. package/build/src/lib/scaffold-allow-scripts.js.map +1 -0
  125. package/build/src/lib/scaffold.d.ts +3 -2
  126. package/build/src/lib/scaffold.d.ts.map +1 -1
  127. package/build/src/lib/scaffold.js +177 -33
  128. package/build/src/lib/scaffold.js.map +1 -1
  129. package/build/src/lib/transpile.d.ts.map +1 -1
  130. package/build/src/lib/transpile.js +6 -5
  131. package/build/src/lib/transpile.js.map +1 -1
  132. package/build/src/lib/type-check.d.ts +3 -1
  133. package/build/src/lib/type-check.d.ts.map +1 -1
  134. package/build/src/lib/type-check.js +22 -6
  135. package/build/src/lib/type-check.js.map +1 -1
  136. package/build/src/lib/utility.d.ts.map +1 -1
  137. package/build/src/lib/utility.js +0 -7
  138. package/build/src/lib/utility.js.map +1 -1
  139. package/build/src/lib/version-contract.d.ts +7 -0
  140. package/build/src/lib/version-contract.d.ts.map +1 -0
  141. package/build/src/lib/version-contract.js +80 -0
  142. package/build/src/lib/version-contract.js.map +1 -0
  143. package/build/src/lib/version-strategy-migration.d.ts +6 -0
  144. package/build/src/lib/version-strategy-migration.d.ts.map +1 -0
  145. package/build/src/lib/version-strategy-migration.js +208 -0
  146. package/build/src/lib/version-strategy-migration.js.map +1 -0
  147. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  148. package/build/src/lib/workflow-templates.js +22 -1
  149. package/build/src/lib/workflow-templates.js.map +1 -1
  150. package/build/src/presets/eslint/dx-ignore.d.ts.map +1 -1
  151. package/build/src/presets/eslint/dx-ignore.js +7 -0
  152. package/build/src/presets/eslint/dx-ignore.js.map +1 -1
  153. package/build/src/types/api/app-store-connect.d.ts +427 -0
  154. package/build/src/types/api/google-play-console.d.ts +146 -0
  155. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +61 -0
  156. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +90 -12
  157. package/build/src/types/cli/index.d.ts +8 -0
  158. package/build/src/types/cli/integration/app-store-connect.d.ts +353 -0
  159. package/build/src/types/cli/integration/discord-developer-portal.d.ts +36 -0
  160. package/build/src/types/cli/integration/google-play-console.d.ts +145 -0
  161. package/build/src/types/cli/integration/index.d.ts +31 -0
  162. package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +16 -0
  163. package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +9 -0
  164. package/build/src/types/cli/utility/changelog.d.ts +149 -0
  165. package/build/src/types/cli/utility/configure.d.ts +122 -3
  166. package/build/src/types/lib/docker-packaging.d.ts +447 -47
  167. package/build/src/types/lib/integration.d.ts +264 -0
  168. package/build/src/types/lib/nova-config.d.ts +9 -0
  169. package/build/src/types/lib/package-scripts.d.ts +2 -0
  170. package/build/src/types/lib/release-history.d.ts +15 -0
  171. package/build/src/types/lib/run-workspaces.d.ts +117 -0
  172. package/build/src/types/lib/scaffold-allow-scripts.d.ts +54 -0
  173. package/build/src/types/lib/scaffold.d.ts +108 -2
  174. package/build/src/types/lib/transpile.d.ts +2 -0
  175. package/build/src/types/lib/type-check.d.ts +28 -0
  176. package/build/src/types/lib/utility.d.ts +0 -13
  177. package/build/src/types/lib/version-contract.d.ts +84 -0
  178. package/build/src/types/lib/version-strategy-migration.d.ts +207 -0
  179. package/build/src/types/shared.d.ts +456 -1
  180. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +49 -0
  181. package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +65 -0
  182. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +4 -0
  183. package/build/src/types/tests/cli/integration.test.d.ts +97 -0
  184. package/build/src/types/tests/cli/recipe/package-json/normalize-tooling.test.d.ts +21 -0
  185. package/build/src/types/tests/cli/recipe/package-json/sync-identity-version-contract.test.d.ts +57 -0
  186. package/build/src/types/tests/cli/scaffold/app/android.test.d.ts +8 -0
  187. package/build/src/types/tests/cli/scaffold/app/apple.test.d.ts +6 -0
  188. package/build/src/types/tests/cli/scaffold/app/expressjs.test.d.ts +4 -0
  189. package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +48 -0
  190. package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +72 -0
  191. package/build/src/types/tests/cli/utility/changelog.test.d.ts +16 -12
  192. package/build/src/types/tests/cli/utility/configure.test.d.ts +88 -0
  193. package/build/src/types/tests/cli/utility/run-scripts.test.d.ts +2 -0
  194. package/build/src/types/tests/cli/utility/run-workspaces.test.d.ts +48 -0
  195. package/build/src/types/tests/lib/docker-packaging.test.d.ts +169 -27
  196. package/build/src/types/tests/lib/ignore-files.test.d.ts +2 -0
  197. package/build/src/types/tests/lib/integration.test.d.ts +60 -0
  198. package/build/src/types/tests/lib/nova-config.test.d.ts +17 -0
  199. package/build/src/types/tests/lib/scaffold-allow-scripts.test.d.ts +14 -0
  200. package/build/src/types/tests/lib/scaffold-version-contract.test.d.ts +59 -0
  201. package/build/src/types/tests/lib/scaffold.test.d.ts +14 -0
  202. package/build/src/types/tests/lib/type-check.test.d.ts +26 -0
  203. package/build/src/types/tests/lib/utility.test.d.ts +21 -0
  204. package/build/src/types/tests/lib/version-contract.test.d.ts +66 -0
  205. package/build/src/types/tests/lib/version-strategy-migration.test.d.ts +85 -0
  206. package/build/src/types/tests/lib/workflow-templates.test.d.ts +4 -0
  207. package/build/src/types/tests/presets/eslint/dx-ignore.test.d.ts +14 -0
  208. package/build/src/types/tests/scaffold-output-contract.test.d.ts +10 -0
  209. package/build/templates/generators/must-haves/agent-conventions/PROJECT_RULES.md +107 -196
  210. package/build/templates/generators/must-haves/agent-conventions/VISION.md +91 -22
  211. package/build/templates/generators/must-haves/agent-conventions/conventions/docker.md +4 -4
  212. package/build/templates/generators/must-haves/agent-conventions/conventions/documentation.md +4 -2
  213. package/build/templates/scaffold/app/android/package.json +2 -2
  214. package/build/templates/scaffold/app/android/scripts/run-gradle.mjs +21 -4
  215. package/build/templates/scaffold/app/apple/package.json +2 -2
  216. package/build/templates/scaffold/app/apple/project.yml +1 -1
  217. package/build/templates/scaffold/app/astro/package.json +2 -2
  218. package/build/templates/scaffold/app/discord-bot/package.json +2 -2
  219. package/build/templates/scaffold/app/express/package.json +2 -2
  220. package/build/templates/scaffold/app/nextjs/package.json +2 -2
  221. package/build/templates/scaffold/app/vite/package.json +2 -2
  222. package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +2 -1
  223. package/build/templates/scaffold/docs/docusaurus/eslint.config.mts +61 -3
  224. package/build/templates/scaffold/docs/docusaurus/package.json +6 -4
  225. package/build/templates/scaffold/docs/docusaurus/src/pages/index.tsx +2 -2
  226. package/build/templates/scaffold/docs/docusaurus/src/tests/dotenv.test.ts +27 -0
  227. package/build/templates/scaffold/docs/docusaurus/src/tests/frontmatter.test.ts +1 -1
  228. package/build/templates/scaffold/docs/docusaurus/src/tests/link.test.ts +1 -1
  229. package/build/templates/scaffold/docs/docusaurus/src/tests/markdown-table.test.ts +1 -1
  230. package/build/templates/scaffold/docs/docusaurus/src/tests/terminology.test.ts +1 -1
  231. package/build/templates/scaffold/docs/docusaurus/src/tests/type-declarations.test.ts +1 -1
  232. package/build/templates/scaffold/docs/docusaurus/src/types/pages/index.d.ts +2 -2
  233. package/build/templates/scaffold/docs/docusaurus/tsconfig.app.json +33 -0
  234. package/build/templates/scaffold/docs/docusaurus/tsconfig.config.json +21 -0
  235. package/build/templates/scaffold/docs/docusaurus/tsconfig.json +11 -17
  236. package/build/templates/scaffold/docs/docusaurus/tsconfig.tests.json +28 -0
  237. package/build/templates/scaffold/docs/docusaurus/vitest.config.mts +1 -14
  238. package/build/templates/scaffold/docs/docusaurus/vitest.setup.ts +3 -3
  239. package/build/templates/scaffold/package/github-action/package.json +2 -2
  240. package/build/templates/scaffold/package/homebridge/bin/repl.mjs +5 -2
  241. package/build/templates/scaffold/package/homebridge/bin/test-api.mjs +5 -2
  242. package/build/templates/scaffold/package/homebridge/package.json +2 -2
  243. package/build/templates/scaffold/package/pfsense/package.json +2 -2
  244. package/build/templates/scaffold/starter/base/assets/README.md +7 -0
  245. package/build/templates/scaffold-options/app/android-native/app/build.gradle.kts +1 -1
  246. package/build/templates/scaffold-options/app/android-native/gradlew.bat +84 -84
  247. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/creative-assets/README.md +10 -0
  248. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/metadata/ios/en-US.json +8 -0
  249. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/metadata/macos/en-US.json +8 -0
  250. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/screenshots/README.md +13 -0
  251. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/graphic-assets/README.md +12 -0
  252. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/metadata/android/en-US.json +6 -0
  253. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/screenshots/README.md +13 -0
  254. package/build/templates/scaffold-options/docker-image/common/Dockerfile +82 -0
  255. package/build/templates/scaffold-options/docker-image/common/compose.yml +21 -0
  256. package/build/templates/scaffold-options/docker-image/common/dockerignore +38 -0
  257. package/build/templates/scaffold-options/package/node-cli-core/bin/cli.mjs +5 -2
  258. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +2 -2
  259. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +2 -2
  260. package/package.json +3 -2
  261. package/build/templates/scaffold-options/docker-image/astro-node/Dockerfile +0 -27
  262. package/build/templates/scaffold-options/docker-image/astro-node/compose.yml +0 -12
  263. package/build/templates/scaffold-options/docker-image/background-service/compose.yml +0 -10
  264. package/build/templates/scaffold-options/docker-image/container-native/Dockerfile +0 -10
  265. package/build/templates/scaffold-options/docker-image/container-native/compose.yml +0 -8
  266. package/build/templates/scaffold-options/docker-image/http-service/compose.yml +0 -11
  267. package/build/templates/scaffold-options/docker-image/nextjs-standalone/Dockerfile +0 -26
  268. package/build/templates/scaffold-options/docker-image/nextjs-standalone/compose.yml +0 -12
  269. package/build/templates/scaffold-options/docker-image/node/Dockerfile +0 -23
  270. package/build/templates/scaffold-options/docker-image/static-site/Dockerfile +0 -18
  271. package/build/templates/scaffold-options/docker-image/static-site/compose.yml +0 -8
@@ -58,7 +58,7 @@ export class Runner {
58
58
  }).info('No workflows configured.');
59
59
  return 'completed';
60
60
  }
61
- const validation = Validator.validate(rawWorkflows, workspaces);
61
+ const validation = Validator.validate(rawWorkflows, workspaces, (config['settings'] === undefined) ? 'semver' : config['settings']['versionStrategy']);
62
62
  const validatedWorkflows = validation['workflows'];
63
63
  for (const diagnosticEntry of validation['diagnostics']) {
64
64
  const diagnostic = diagnosticEntry;
@@ -476,6 +476,12 @@ export class Runner {
476
476
  const publishConditionParts = [];
477
477
  const runNameParts = [];
478
478
  const triggers = entry['triggers'];
479
+ const targets = entry['deploy'] ?? [];
480
+ const hasContainerTarget = targets.some((target) => target['to'] === 'docker-hub' || target['to'] === 'ghcr');
481
+ const containerPlatforms = entry['containerPlatforms'] ?? [
482
+ 'linux/amd64',
483
+ 'linux/arm64',
484
+ ];
479
485
  const dependsOn = [];
480
486
  for (const dependsOnTriggerValue of triggers) {
481
487
  const dependsOnTrigger = dependsOnTriggerValue;
@@ -573,15 +579,25 @@ export class Runner {
573
579
  Reflect.set(mergedPush, 'paths', mergedPaths);
574
580
  }
575
581
  }
582
+ const dispatchInputs = [{
583
+ name: 'dry-run',
584
+ description: 'Run without making changes',
585
+ required: false,
586
+ type: 'boolean',
587
+ default: true,
588
+ }];
589
+ if (hasContainerTarget === true) {
590
+ dispatchInputs.push({
591
+ name: 'tag',
592
+ description: 'Required image tag when manually publishing',
593
+ required: false,
594
+ type: 'string',
595
+ default: '',
596
+ });
597
+ }
576
598
  mergedOn.push({
577
599
  event: 'workflow_dispatch',
578
- inputs: [{
579
- name: 'dry-run',
580
- description: 'Run without making changes',
581
- required: false,
582
- type: 'boolean',
583
- default: true,
584
- }],
600
+ inputs: dispatchInputs,
585
601
  });
586
602
  const publishCondition = [
587
603
  ...publishConditionParts.map((part) => ((part.includes('&&') === true) ? `(${part})` : part)),
@@ -613,16 +629,22 @@ export class Runner {
613
629
  const workspace = workspaces[scope];
614
630
  return workspace['name'];
615
631
  });
616
- const checkCommand = Runner.runScriptCommand(packageManager, 'check');
632
+ const checkCommand = Runner.buildScopeCommand('check', names, packageManager);
617
633
  const buildCommand = Runner.buildScopeCommand('build', names, packageManager);
618
634
  const steps = [
619
635
  {
620
636
  name: 'Checkout repository',
621
637
  uses: getScaffoldVersion('workflowActionCheckout'),
622
- with: [{
638
+ with: [
639
+ {
623
640
  key: 'fetch-depth',
624
641
  value: 0,
625
- }],
642
+ },
643
+ ...((hasWorkflowRunNode === true) ? [{
644
+ key: 'ref',
645
+ value: Runner.expr('github.event.workflow_run.head_sha'),
646
+ }] : []),
647
+ ],
626
648
  },
627
649
  {
628
650
  name: 'Setup Node.js',
@@ -667,13 +689,31 @@ export class Runner {
667
689
  runBlock: true,
668
690
  workingDirectory: Runner.expr('env.ROOT_DIR'),
669
691
  });
670
- steps.push({
671
- name: 'Build project',
672
- run: buildCommand,
673
- runBlock: true,
674
- workingDirectory: Runner.expr('env.ROOT_DIR'),
675
- });
676
- const targets = entry['deploy'] ?? [];
692
+ if (names.length > 0) {
693
+ steps.push({
694
+ name: 'Build project',
695
+ run: buildCommand,
696
+ runBlock: true,
697
+ workingDirectory: Runner.expr('env.ROOT_DIR'),
698
+ });
699
+ }
700
+ if (hasContainerTarget === true) {
701
+ steps.push({
702
+ name: 'Validate manual container tag',
703
+ if: Runner.expr('github.event_name == \'workflow_dispatch\' && !inputs.dry-run'),
704
+ env: [{
705
+ key: 'MANUAL_TAG',
706
+ value: Runner.expr('inputs.tag || \'\''),
707
+ }],
708
+ run: [
709
+ 'if [ -z "$MANUAL_TAG" ]; then',
710
+ ' echo "A non-empty tag input is required for a real manual container publish." >&2',
711
+ ' exit 1',
712
+ 'fi',
713
+ ].join('\n'),
714
+ runBlock: true,
715
+ });
716
+ }
677
717
  for (const target of targets) {
678
718
  const uploadTarget = target;
679
719
  const uploadMetadata = Variables.getTargetMetadata('publish', uploadTarget['to']);
@@ -705,6 +745,10 @@ export class Runner {
705
745
  };
706
746
  steps.push(uploadStep);
707
747
  }
748
+ if (hasContainerTarget === true) {
749
+ const containerArtifactSteps = Runner.buildContainerArtifactSteps(containerPlatforms);
750
+ steps.push(...containerArtifactSteps);
751
+ }
708
752
  const buildJob = {
709
753
  id: 'build',
710
754
  runsOn: 'ubuntu-latest',
@@ -718,10 +762,11 @@ export class Runner {
718
762
  for (const target of targets) {
719
763
  const deployTarget = target;
720
764
  const targetSettings = deployTarget['with'];
765
+ const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
721
766
  const context = {
722
767
  workingDir: deployTarget['path'],
723
- artifactName: `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`,
724
- needs: Runner.resolveDeployNeeds(deployTarget),
768
+ artifactName: (isContainerTarget === true) ? 'container-oci' : `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`,
769
+ needs: (isContainerTarget === true) ? ['build'] : Runner.resolveDeployNeeds(deployTarget),
725
770
  targetSettings,
726
771
  workflowSettings,
727
772
  workspace: workspaces[deployTarget['path']],
@@ -756,6 +801,12 @@ export class Runner {
756
801
  jobs.push(Runner.buildVercelNextjsTarget(context));
757
802
  }
758
803
  }
804
+ const configuredTimeoutMinutes = entry['timeoutMinutes'];
805
+ if (configuredTimeoutMinutes !== undefined) {
806
+ for (const configuredJob of jobs) {
807
+ configuredJob.timeoutMinutes = configuredTimeoutMinutes;
808
+ }
809
+ }
759
810
  if (jobsCondition !== undefined) {
760
811
  for (const gatedJob of jobs) {
761
812
  Reflect.set(gatedJob, 'if', jobsCondition);
@@ -1163,9 +1214,13 @@ export class Runner {
1163
1214
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1164
1215
  const environment = context['environment'];
1165
1216
  const appPath = context['workingDir'];
1217
+ const imageNamespace = (targetSettings === undefined) ? 'IMAGE_NAMESPACE' : targetSettings['IMAGE_NAMESPACE'] ?? 'IMAGE_NAMESPACE';
1218
+ const imageRepository = (targetSettings === undefined) ? 'IMAGE_REPOSITORY' : targetSettings['IMAGE_REPOSITORY'] ?? 'IMAGE_REPOSITORY';
1166
1219
  return Runner.buildContainerRegistryTarget(context, {
1167
1220
  registrySlug: 'docker-hub',
1168
- imageTagPrefix: '',
1221
+ registryHost: 'docker.io',
1222
+ imageNamespace,
1223
+ imageRepository,
1169
1224
  loginStep: {
1170
1225
  name: 'Login to Docker Hub',
1171
1226
  uses: getScaffoldVersion('workflowActionDockerLogin'),
@@ -1185,7 +1240,6 @@ export class Runner {
1185
1240
  ],
1186
1241
  },
1187
1242
  extraPermissions: {},
1188
- attestationSubjectPrefix: 'docker.io/',
1189
1243
  });
1190
1244
  }
1191
1245
  static buildGhcrTarget(context) {
@@ -1193,9 +1247,12 @@ export class Runner {
1193
1247
  const workflowSettings = context['workflowSettings'];
1194
1248
  const metadata = Variables.getTargetMetadata('publish', 'ghcr');
1195
1249
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1250
+ const imageRepository = (targetSettings === undefined) ? 'IMAGE_REPOSITORY' : targetSettings['IMAGE_REPOSITORY'] ?? 'IMAGE_REPOSITORY';
1196
1251
  return Runner.buildContainerRegistryTarget(context, {
1197
1252
  registrySlug: 'ghcr',
1198
- imageTagPrefix: 'ghcr.io/',
1253
+ registryHost: 'ghcr.io',
1254
+ imageNamespace: Runner.expr('github.repository_owner'),
1255
+ imageRepository,
1199
1256
  loginStep: {
1200
1257
  name: 'Login to GitHub Container Registry',
1201
1258
  uses: getScaffoldVersion('workflowActionDockerLogin'),
@@ -1206,7 +1263,7 @@ export class Runner {
1206
1263
  },
1207
1264
  {
1208
1265
  key: 'username',
1209
- value: Runner.expr('github.repository_owner'),
1266
+ value: Runner.expr('github.actor'),
1210
1267
  },
1211
1268
  {
1212
1269
  key: 'password',
@@ -1215,7 +1272,6 @@ export class Runner {
1215
1272
  ],
1216
1273
  },
1217
1274
  extraPermissions: { 'packages': 'write' },
1218
- attestationSubjectPrefix: 'ghcr.io/',
1219
1275
  });
1220
1276
  }
1221
1277
  static buildGithubPagesDocusaurusTarget(context) {
@@ -1610,18 +1666,95 @@ export class Runner {
1610
1666
  steps,
1611
1667
  };
1612
1668
  }
1669
+ static buildContainerArtifactSteps(platforms) {
1670
+ const platformList = platforms.join(',');
1671
+ return [
1672
+ {
1673
+ name: 'Set up QEMU',
1674
+ uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
1675
+ with: [{
1676
+ key: 'platforms',
1677
+ value: platformList,
1678
+ }],
1679
+ },
1680
+ {
1681
+ name: 'Set up Docker Buildx',
1682
+ uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
1683
+ },
1684
+ {
1685
+ name: 'Prepare OCI handoff',
1686
+ run: 'mkdir -p "$RUNNER_TEMP/container-oci"',
1687
+ },
1688
+ {
1689
+ name: 'Build immutable OCI artifact',
1690
+ id: 'build-oci',
1691
+ uses: getScaffoldVersion('workflowActionDockerBuildPush'),
1692
+ with: [
1693
+ {
1694
+ key: 'context',
1695
+ value: './',
1696
+ },
1697
+ {
1698
+ key: 'platforms',
1699
+ value: platformList,
1700
+ },
1701
+ {
1702
+ key: 'push',
1703
+ value: false,
1704
+ },
1705
+ {
1706
+ key: 'provenance',
1707
+ value: false,
1708
+ },
1709
+ {
1710
+ key: 'tags',
1711
+ value: 'nova.local/container:nova-oci',
1712
+ },
1713
+ {
1714
+ key: 'outputs',
1715
+ value: `type=oci,dest=${Runner.expr('runner.temp')}/container-oci/layout,tar=false`,
1716
+ },
1717
+ ],
1718
+ },
1719
+ {
1720
+ name: 'Record OCI digest',
1721
+ run: `printf '%s' '${Runner.expr('steps.build-oci.outputs.digest')}' > "$RUNNER_TEMP/container-oci/container-image.digest"`,
1722
+ },
1723
+ {
1724
+ name: 'Upload immutable OCI artifact',
1725
+ uses: getScaffoldVersion('workflowActionUploadArtifact'),
1726
+ with: [
1727
+ {
1728
+ key: 'name',
1729
+ value: 'container-oci',
1730
+ },
1731
+ {
1732
+ key: 'retention-days',
1733
+ value: 1,
1734
+ },
1735
+ {
1736
+ key: 'path',
1737
+ value: `${Runner.expr('runner.temp')}/container-oci`,
1738
+ },
1739
+ ],
1740
+ },
1741
+ ];
1742
+ }
1613
1743
  static buildContainerRegistryTarget(context, config) {
1614
1744
  const registrySlug = config['registrySlug'];
1615
- const imageTagPrefix = config['imageTagPrefix'];
1745
+ const registryHost = config['registryHost'];
1746
+ const imageNamespace = config['imageNamespace'];
1747
+ const imageRepository = config['imageRepository'];
1616
1748
  const loginStep = config['loginStep'];
1617
1749
  const extraPermissions = config['extraPermissions'];
1618
- const attestationSubjectPrefix = config['attestationSubjectPrefix'];
1619
- const imageTags = [
1620
- `${imageTagPrefix}${Runner.expr('github.repository')}:latest`,
1621
- `${imageTagPrefix}${Runner.expr('github.repository')}:${Runner.expr('github.event.release.tag_name || \'manual\'')}`,
1622
- ].join('\n');
1750
+ const resolveTagsRun = Runner.resolveContainerTagsRun();
1751
+ const checkImmutableTagsRun = Runner.checkImmutableContainerTagsRun();
1752
+ const pushRun = Runner.pushContainerArtifactRun();
1753
+ const verifyRun = Runner.verifyContainerArtifactRun();
1754
+ const tagRun = Runner.tagContainerArtifactRun();
1755
+ Reflect.set(loginStep, 'if', Runner.expr('env.PUBLISH == \'true\''));
1623
1756
  return {
1624
- id: `publish-${registrySlug}-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1757
+ id: `publish-${registrySlug}-root`,
1625
1758
  needs: context['needs'],
1626
1759
  runsOn: 'ubuntu-latest',
1627
1760
  timeoutMinutes: 15,
@@ -1634,45 +1767,106 @@ export class Runner {
1634
1767
  },
1635
1768
  steps: [
1636
1769
  {
1637
- name: 'Checkout repository',
1638
- uses: getScaffoldVersion('workflowActionCheckout'),
1770
+ name: 'Download immutable OCI artifact',
1771
+ uses: getScaffoldVersion('workflowActionDownloadArtifact'),
1772
+ with: [
1773
+ {
1774
+ key: 'name',
1775
+ value: context['artifactName'],
1776
+ },
1777
+ {
1778
+ key: 'path',
1779
+ value: `${Runner.expr('runner.temp')}/container-oci`,
1780
+ },
1781
+ ],
1639
1782
  },
1640
1783
  {
1641
- name: 'Set up QEMU',
1642
- uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
1784
+ name: 'Set up ORAS',
1785
+ uses: getScaffoldVersion('workflowActionSetupOras'),
1643
1786
  with: [{
1644
- key: 'platforms',
1645
- value: 'linux/amd64,linux/arm64',
1787
+ key: 'version',
1788
+ value: '1.3.3',
1646
1789
  }],
1647
1790
  },
1648
1791
  {
1649
- name: 'Set up Docker Buildx',
1650
- uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
1651
- },
1652
- loginStep,
1653
- {
1654
- name: 'Build and push',
1655
- id: 'build-push',
1656
- uses: getScaffoldVersion('workflowActionDockerBuildPush'),
1657
- with: [
1792
+ name: 'Resolve image coordinate and tags',
1793
+ env: [
1794
+ {
1795
+ key: 'EVENT_NAME',
1796
+ value: Runner.expr('github.event_name'),
1797
+ },
1658
1798
  {
1659
- key: 'context',
1660
- value: context['workingDir'],
1799
+ key: 'IMAGE_NAMESPACE',
1800
+ value: imageNamespace,
1661
1801
  },
1662
1802
  {
1663
- key: 'platforms',
1664
- value: 'linux/amd64,linux/arm64',
1803
+ key: 'IMAGE_REPOSITORY',
1804
+ value: imageRepository,
1665
1805
  },
1666
1806
  {
1667
- key: 'push',
1807
+ key: 'MANUAL_TAG',
1808
+ value: Runner.expr('inputs.tag || \'\''),
1809
+ },
1810
+ {
1811
+ key: 'PUBLISH',
1668
1812
  value: Runner.expr('env.PUBLISH'),
1669
1813
  },
1670
1814
  {
1671
- key: 'tags',
1672
- value: imageTags,
1673
- block: true,
1815
+ key: 'REF_NAME',
1816
+ value: Runner.expr('github.ref_name'),
1817
+ },
1818
+ {
1819
+ key: 'REF_TYPE',
1820
+ value: Runner.expr('github.ref_type'),
1821
+ },
1822
+ {
1823
+ key: 'REGISTRY_HOST',
1824
+ value: registryHost,
1825
+ },
1826
+ {
1827
+ key: 'RELEASE_PRERELEASE',
1828
+ value: Runner.expr('github.event.release.prerelease || false'),
1829
+ },
1830
+ {
1831
+ key: 'RELEASE_TAG',
1832
+ value: Runner.expr('github.event.release.tag_name || \'\''),
1833
+ },
1834
+ {
1835
+ key: 'SOURCE_SHA',
1836
+ value: Runner.expr('github.event_name == \'workflow_run\' && github.event.workflow_run.head_sha || github.sha'),
1837
+ },
1838
+ {
1839
+ key: 'WORKFLOW_BRANCH',
1840
+ value: Runner.expr('github.event.workflow_run.head_branch || \'\''),
1674
1841
  },
1675
1842
  ],
1843
+ run: resolveTagsRun,
1844
+ runBlock: true,
1845
+ },
1846
+ loginStep,
1847
+ {
1848
+ name: 'Reject conflicting immutable tags',
1849
+ if: Runner.expr('env.PUBLISH == \'true\''),
1850
+ run: checkImmutableTagsRun,
1851
+ runBlock: true,
1852
+ },
1853
+ {
1854
+ name: 'Push immutable OCI artifact',
1855
+ if: Runner.expr('env.PUBLISH == \'true\''),
1856
+ run: pushRun,
1857
+ runBlock: true,
1858
+ },
1859
+ {
1860
+ name: 'Apply image tags',
1861
+ if: Runner.expr('env.PUBLISH == \'true\' && env.ADDITIONAL_TAGS != \'\''),
1862
+ run: tagRun,
1863
+ runBlock: true,
1864
+ },
1865
+ {
1866
+ name: 'Verify immutable image tags',
1867
+ if: Runner.expr('env.PUBLISH == \'true\''),
1868
+ run: verifyRun,
1869
+ runBlock: true,
1676
1870
  },
1677
1871
  {
1678
1872
  name: 'Generate build provenance',
@@ -1681,11 +1875,11 @@ export class Runner {
1681
1875
  with: [
1682
1876
  {
1683
1877
  key: 'subject-name',
1684
- value: `${attestationSubjectPrefix}${Runner.expr('github.repository')}`,
1878
+ value: Runner.expr('env.IMAGE'),
1685
1879
  },
1686
1880
  {
1687
1881
  key: 'subject-digest',
1688
- value: Runner.expr('steps.build-push.outputs.digest'),
1882
+ value: Runner.expr('env.IMAGE_DIGEST'),
1689
1883
  },
1690
1884
  {
1691
1885
  key: 'push-to-registry',
@@ -1693,12 +1887,217 @@ export class Runner {
1693
1887
  },
1694
1888
  ],
1695
1889
  },
1890
+ {
1891
+ name: 'Publish latest channel',
1892
+ if: Runner.expr('env.PUBLISH == \'true\' && env.PUBLISH_LATEST == \'true\''),
1893
+ run: 'oras tag "$IMAGE@$IMAGE_DIGEST" latest',
1894
+ },
1696
1895
  ],
1697
1896
  };
1698
1897
  }
1898
+ static resolveContainerTagsRun() {
1899
+ return [
1900
+ 'set -euo pipefail',
1901
+ '',
1902
+ 'image_namespace="$(printf "%s" "$IMAGE_NAMESPACE" | tr "[:upper:]" "[:lower:]")"',
1903
+ '',
1904
+ 'if [[ ! "$image_namespace" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then',
1905
+ ' echo "Invalid image namespace: $IMAGE_NAMESPACE" >&2',
1906
+ ' exit 1',
1907
+ 'fi',
1908
+ '',
1909
+ 'if [[ ! "$IMAGE_REPOSITORY" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then',
1910
+ ' echo "Invalid image repository: $IMAGE_REPOSITORY" >&2',
1911
+ ' exit 1',
1912
+ 'fi',
1913
+ '',
1914
+ 'image="$REGISTRY_HOST/$image_namespace/$IMAGE_REPOSITORY"',
1915
+ '',
1916
+ `if [ "${'$'}{#image}" -gt 255 ] || [[ ! "$image" =~ ^(docker\\.io|ghcr\\.io)/[a-z0-9]+([._-][a-z0-9]+)*/[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then`,
1917
+ ' echo "Invalid final image coordinate: $image" >&2',
1918
+ ' exit 1',
1919
+ 'fi',
1920
+ '',
1921
+ 'source_sha="$(printf "%s" "$SOURCE_SHA" | tr "[:upper:]" "[:lower:]")"',
1922
+ '',
1923
+ 'if [[ ! "$source_sha" =~ ^[0-9a-f]{7,64}$ ]]; then',
1924
+ ' echo "Invalid source SHA: $SOURCE_SHA" >&2',
1925
+ ' exit 1',
1926
+ 'fi',
1927
+ '',
1928
+ 'tags=("sha-$source_sha")',
1929
+ 'immutable_tags=("sha-$source_sha")',
1930
+ 'publish_latest=false',
1931
+ '',
1932
+ 'append_unique() {',
1933
+ ' local candidate="$1"',
1934
+ ' local existing',
1935
+ '',
1936
+ ` for existing in "${'$'}{tags[@]}"; do`,
1937
+ ' if [ "$existing" = "$candidate" ]; then',
1938
+ ' return',
1939
+ ' fi',
1940
+ ' done',
1941
+ '',
1942
+ ' tags+=("$candidate")',
1943
+ '}',
1944
+ '',
1945
+ 'append_immutable() {',
1946
+ ' local candidate="$1"',
1947
+ ' local existing',
1948
+ '',
1949
+ ` for existing in "${'$'}{immutable_tags[@]}"; do`,
1950
+ ' if [ "$existing" = "$candidate" ]; then',
1951
+ ' return',
1952
+ ' fi',
1953
+ ' done',
1954
+ '',
1955
+ ' immutable_tags+=("$candidate")',
1956
+ '}',
1957
+ '',
1958
+ 'validate_exact_tag() {',
1959
+ ' local tag="$1"',
1960
+ ' local source="$2"',
1961
+ '',
1962
+ ' if [ "$tag" = "latest" ]; then',
1963
+ ' echo "The exact $source image tag latest is reserved for stable releases." >&2',
1964
+ ' exit 1',
1965
+ ' fi',
1966
+ '',
1967
+ ' if [[ ! "$tag" =~ ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$ ]]; then',
1968
+ ' echo "Invalid exact $source image tag: $tag" >&2',
1969
+ ' exit 1',
1970
+ ' fi',
1971
+ '}',
1972
+ '',
1973
+ 'normalize_channel() {',
1974
+ ' local normalized',
1975
+ '',
1976
+ ' normalized="$(printf "%s" "$1" | tr "[:upper:]" "[:lower:]" | sed -E "s/[^a-z0-9_.-]+/-/g; s/^[.-]+//; s/[.-]+$//")"',
1977
+ ` normalized="${'$'}{normalized:0:110}"`,
1978
+ '',
1979
+ ' if [ -z "$normalized" ]; then',
1980
+ ' echo "Unable to derive a valid channel tag from: $1" >&2',
1981
+ ' exit 1',
1982
+ ' fi',
1983
+ '',
1984
+ ' printf "%s" "$normalized"',
1985
+ '}',
1986
+ '',
1987
+ 'case "$EVENT_NAME" in',
1988
+ ' release)',
1989
+ ' validate_exact_tag "$RELEASE_TAG" "release"',
1990
+ ' append_unique "$RELEASE_TAG"',
1991
+ ' append_immutable "$RELEASE_TAG"',
1992
+ '',
1993
+ ' if [ "$RELEASE_PRERELEASE" = "false" ]; then',
1994
+ ' publish_latest=true',
1995
+ ' fi',
1996
+ ' ;;',
1997
+ ' push)',
1998
+ ' if [ "$REF_TYPE" = "tag" ]; then',
1999
+ ' validate_exact_tag "$REF_NAME" "pushed"',
2000
+ ' append_unique "$REF_NAME"',
2001
+ ' append_immutable "$REF_NAME"',
2002
+ ' else',
2003
+ ' append_unique "branch-$(normalize_channel "$REF_NAME")"',
2004
+ ' fi',
2005
+ ' ;;',
2006
+ ' workflow_run)',
2007
+ ' append_unique "workflow-$(normalize_channel "$WORKFLOW_BRANCH")"',
2008
+ ' ;;',
2009
+ ' workflow_dispatch)',
2010
+ ' if [ "$PUBLISH" = "true" ] && [ -z "$MANUAL_TAG" ]; then',
2011
+ ' echo "A non-empty tag input is required for a real manual container publish." >&2',
2012
+ ' exit 1',
2013
+ ' fi',
2014
+ '',
2015
+ ' if [ -n "$MANUAL_TAG" ]; then',
2016
+ ' validate_exact_tag "$MANUAL_TAG" "manual"',
2017
+ ' append_unique "$MANUAL_TAG"',
2018
+ ' append_immutable "$MANUAL_TAG"',
2019
+ ' fi',
2020
+ ' ;;',
2021
+ ' *)',
2022
+ ' echo "Unsupported container publish event: $EVENT_NAME" >&2',
2023
+ ' exit 1',
2024
+ ' ;;',
2025
+ 'esac',
2026
+ '',
2027
+ `additional_tags=("${'$'}{tags[@]:1}")`,
2028
+ `additional_tags_csv="$(IFS=,; printf "%s" "${'$'}{additional_tags[*]}")"`,
2029
+ `immutable_tags_csv="$(IFS=,; printf "%s" "${'$'}{immutable_tags[*]}")"`,
2030
+ '',
2031
+ '{',
2032
+ ' echo "ADDITIONAL_TAGS=$additional_tags_csv"',
2033
+ ' echo "IMAGE=$image"',
2034
+ ' echo "IMMUTABLE_TAGS=$immutable_tags_csv"',
2035
+ ' echo "PUBLISH_LATEST=$publish_latest"',
2036
+ ' echo "SHA_TAG=sha-$source_sha"',
2037
+ '} >> "$GITHUB_ENV"',
2038
+ ].join('\n');
2039
+ }
2040
+ static checkImmutableContainerTagsRun() {
2041
+ return [
2042
+ 'set -euo pipefail',
2043
+ '',
2044
+ 'expected_digest="$(cat "$RUNNER_TEMP/container-oci/container-image.digest")"',
2045
+ 'IFS="," read -r -a immutable_tags <<< "$IMMUTABLE_TAGS"',
2046
+ '',
2047
+ `for tag in "${'$'}{immutable_tags[@]}"; do`,
2048
+ ' if resolve_output="$(oras resolve "$IMAGE:$tag" 2>&1)"; then',
2049
+ ' actual_digest="$resolve_output"',
2050
+ '',
2051
+ ' if [ "$actual_digest" != "$expected_digest" ]; then',
2052
+ ' echo "Immutable image tag conflict: $IMAGE:$tag already resolves to $actual_digest, expected $expected_digest." >&2',
2053
+ ' exit 1',
2054
+ ' fi',
2055
+ ' else',
2056
+ ' resolve_error="$(printf "%s" "$resolve_output" | tr "[:upper:]" "[:lower:]")"',
2057
+ '',
2058
+ ' if [[ "$resolve_error" != *"not found"* && "$resolve_error" != *"manifest unknown"* ]]; then',
2059
+ ' echo "Unable to determine whether immutable image tag $IMAGE:$tag exists: $resolve_output" >&2',
2060
+ ' exit 1',
2061
+ ' fi',
2062
+ ' fi',
2063
+ 'done',
2064
+ ].join('\n');
2065
+ }
2066
+ static pushContainerArtifactRun() {
2067
+ return 'oras cp --from-oci-layout "$RUNNER_TEMP/container-oci/layout@$(cat "$RUNNER_TEMP/container-oci/container-image.digest")" "$IMAGE:$SHA_TAG"';
2068
+ }
2069
+ static tagContainerArtifactRun() {
2070
+ return [
2071
+ 'set -euo pipefail',
2072
+ '',
2073
+ 'expected_digest="$(cat "$RUNNER_TEMP/container-oci/container-image.digest")"',
2074
+ 'IFS="," read -r -a additional_tags <<< "$ADDITIONAL_TAGS"',
2075
+ `oras tag "$IMAGE@$expected_digest" "${'$'}{additional_tags[@]}"`,
2076
+ ].join('\n');
2077
+ }
2078
+ static verifyContainerArtifactRun() {
2079
+ return [
2080
+ 'set -euo pipefail',
2081
+ '',
2082
+ 'expected_digest="$(cat "$RUNNER_TEMP/container-oci/container-image.digest")"',
2083
+ 'IFS="," read -r -a immutable_tags <<< "$IMMUTABLE_TAGS"',
2084
+ '',
2085
+ `for tag in "${'$'}{immutable_tags[@]}"; do`,
2086
+ ' published_digest="$(oras resolve "$IMAGE:$tag")"',
2087
+ '',
2088
+ ' if [ "$published_digest" != "$expected_digest" ]; then',
2089
+ ' echo "Published digest mismatch for $IMAGE:$tag: got $published_digest, expected $expected_digest." >&2',
2090
+ ' exit 1',
2091
+ ' fi',
2092
+ 'done',
2093
+ '',
2094
+ 'echo "IMAGE_DIGEST=$expected_digest" >> "$GITHUB_ENV"',
2095
+ ].join('\n');
2096
+ }
1699
2097
  static buildScopeCommand(scriptName, workspaceNames, packageManager) {
1700
- const workspaceFlags = workspaceNames.map((workspaceName) => `--workspace ${workspaceName}`).join(' ');
1701
- return `${packageManager} run ${scriptName}:workspaces -- ${workspaceFlags}`;
2098
+ const selectedNames = (workspaceNames.length > 0) ? workspaceNames : ['./'];
2099
+ const workspaceFlags = selectedNames.map((workspaceName) => `--workspace ${workspaceName}`).join(' ');
2100
+ return `${packageManager} run ${scriptName} -- ${workspaceFlags}`;
1702
2101
  }
1703
2102
  static corepackDownloadCommand(packageManager, packageName, commandArguments) {
1704
2103
  if (packageManager === 'npm') {