@cbnventures/nova 0.32.0 → 0.34.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 (316) 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 +219 -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 +469 -59
  19. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  20. package/build/src/cli/index.js +188 -47
  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/github/sync-rulesets.js +2 -2
  39. package/build/src/cli/recipe/github/sync-rulesets.js.map +1 -1
  40. package/build/src/cli/recipe/index.d.ts.map +1 -1
  41. package/build/src/cli/recipe/index.js +5 -0
  42. package/build/src/cli/recipe/index.js.map +1 -1
  43. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.d.ts.map +1 -1
  44. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.js +15 -0
  45. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.js.map +1 -1
  46. package/build/src/cli/recipe/nova-config/normalize-order.d.ts +5 -0
  47. package/build/src/cli/recipe/nova-config/normalize-order.d.ts.map +1 -0
  48. package/build/src/cli/recipe/nova-config/normalize-order.js +104 -0
  49. package/build/src/cli/recipe/nova-config/normalize-order.js.map +1 -0
  50. package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
  51. package/build/src/cli/recipe/package-json/normalize-tooling.js +55 -10
  52. package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
  53. package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
  54. package/build/src/cli/recipe/package-json/sync-identity.js +51 -18
  55. package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
  56. package/build/src/cli/scaffold/app/android.d.ts.map +1 -1
  57. package/build/src/cli/scaffold/app/android.js +6 -0
  58. package/build/src/cli/scaffold/app/android.js.map +1 -1
  59. package/build/src/cli/scaffold/app/apple.d.ts.map +1 -1
  60. package/build/src/cli/scaffold/app/apple.js +7 -0
  61. package/build/src/cli/scaffold/app/apple.js.map +1 -1
  62. package/build/src/cli/scaffold/app/astro.d.ts.map +1 -1
  63. package/build/src/cli/scaffold/app/astro.js +15 -0
  64. package/build/src/cli/scaffold/app/astro.js.map +1 -1
  65. package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
  66. package/build/src/cli/scaffold/app/discord-bot.js +20 -1
  67. package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
  68. package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
  69. package/build/src/cli/scaffold/app/expressjs.js +20 -1
  70. package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
  71. package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
  72. package/build/src/cli/scaffold/app/nextjs.js +9 -1
  73. package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
  74. package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
  75. package/build/src/cli/scaffold/app/vite.js +15 -1
  76. package/build/src/cli/scaffold/app/vite.js.map +1 -1
  77. package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
  78. package/build/src/cli/scaffold/docs/docusaurus.js +13 -2
  79. package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
  80. package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
  81. package/build/src/cli/scaffold/package/github-action.js +5 -0
  82. package/build/src/cli/scaffold/package/github-action.js.map +1 -1
  83. package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
  84. package/build/src/cli/scaffold/package/homebridge.js +5 -0
  85. package/build/src/cli/scaffold/package/homebridge.js.map +1 -1
  86. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  87. package/build/src/cli/scaffold/package/pfsense.js +5 -0
  88. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  89. package/build/src/cli/scaffold/starter/base.d.ts.map +1 -1
  90. package/build/src/cli/scaffold/starter/base.js +2 -1
  91. package/build/src/cli/scaffold/starter/base.js.map +1 -1
  92. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  93. package/build/src/cli/scaffold/tool/serverless.js +9 -0
  94. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  95. package/build/src/cli/utility/changelog.d.ts +2 -0
  96. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  97. package/build/src/cli/utility/changelog.js +241 -129
  98. package/build/src/cli/utility/changelog.js.map +1 -1
  99. package/build/src/cli/utility/configure.d.ts +4 -1
  100. package/build/src/cli/utility/configure.d.ts.map +1 -1
  101. package/build/src/cli/utility/configure.js +414 -58
  102. package/build/src/cli/utility/configure.js.map +1 -1
  103. package/build/src/cli/utility/run-recipes.d.ts.map +1 -1
  104. package/build/src/cli/utility/run-recipes.js +7 -26
  105. package/build/src/cli/utility/run-recipes.js.map +1 -1
  106. package/build/src/lib/constants.d.ts +2 -1
  107. package/build/src/lib/constants.d.ts.map +1 -1
  108. package/build/src/lib/constants.js +1 -0
  109. package/build/src/lib/constants.js.map +1 -1
  110. package/build/src/lib/docker-packaging.d.ts +22 -1
  111. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  112. package/build/src/lib/docker-packaging.js +1044 -76
  113. package/build/src/lib/docker-packaging.js.map +1 -1
  114. package/build/src/lib/file-discovery.js +1 -1
  115. package/build/src/lib/file-discovery.js.map +1 -1
  116. package/build/src/lib/ignore-files.d.ts.map +1 -1
  117. package/build/src/lib/ignore-files.js +4 -1
  118. package/build/src/lib/ignore-files.js.map +1 -1
  119. package/build/src/lib/integration.d.ts +14 -0
  120. package/build/src/lib/integration.d.ts.map +1 -0
  121. package/build/src/lib/integration.js +323 -0
  122. package/build/src/lib/integration.js.map +1 -0
  123. package/build/src/lib/item.d.ts.map +1 -1
  124. package/build/src/lib/item.js +5 -1
  125. package/build/src/lib/item.js.map +1 -1
  126. package/build/src/lib/nova-config-order.d.ts +3 -0
  127. package/build/src/lib/nova-config-order.d.ts.map +1 -0
  128. package/build/src/lib/nova-config-order.js +38 -0
  129. package/build/src/lib/nova-config-order.js.map +1 -0
  130. package/build/src/lib/nova-config.d.ts +2 -2
  131. package/build/src/lib/nova-config.d.ts.map +1 -1
  132. package/build/src/lib/nova-config.js +73 -8
  133. package/build/src/lib/nova-config.js.map +1 -1
  134. package/build/src/lib/package-scripts.d.ts.map +1 -1
  135. package/build/src/lib/package-scripts.js +2 -1
  136. package/build/src/lib/package-scripts.js.map +1 -1
  137. package/build/src/lib/regex.d.ts +8 -0
  138. package/build/src/lib/regex.d.ts.map +1 -1
  139. package/build/src/lib/regex.js +10 -2
  140. package/build/src/lib/regex.js.map +1 -1
  141. package/build/src/lib/release-history.d.ts +2 -1
  142. package/build/src/lib/release-history.d.ts.map +1 -1
  143. package/build/src/lib/release-history.js +18 -0
  144. package/build/src/lib/release-history.js.map +1 -1
  145. package/build/src/lib/run-workspaces.d.ts +3 -0
  146. package/build/src/lib/run-workspaces.d.ts.map +1 -1
  147. package/build/src/lib/run-workspaces.js +132 -2
  148. package/build/src/lib/run-workspaces.js.map +1 -1
  149. package/build/src/lib/scaffold-allow-scripts.d.ts +4 -0
  150. package/build/src/lib/scaffold-allow-scripts.d.ts.map +1 -0
  151. package/build/src/lib/scaffold-allow-scripts.js +76 -0
  152. package/build/src/lib/scaffold-allow-scripts.js.map +1 -0
  153. package/build/src/lib/scaffold.d.ts +4 -3
  154. package/build/src/lib/scaffold.d.ts.map +1 -1
  155. package/build/src/lib/scaffold.js +287 -44
  156. package/build/src/lib/scaffold.js.map +1 -1
  157. package/build/src/lib/transpile.d.ts.map +1 -1
  158. package/build/src/lib/transpile.js +6 -5
  159. package/build/src/lib/transpile.js.map +1 -1
  160. package/build/src/lib/type-check.d.ts +3 -1
  161. package/build/src/lib/type-check.d.ts.map +1 -1
  162. package/build/src/lib/type-check.js +22 -6
  163. package/build/src/lib/type-check.js.map +1 -1
  164. package/build/src/lib/utility.d.ts.map +1 -1
  165. package/build/src/lib/utility.js +0 -7
  166. package/build/src/lib/utility.js.map +1 -1
  167. package/build/src/lib/version-contract.d.ts +7 -0
  168. package/build/src/lib/version-contract.d.ts.map +1 -0
  169. package/build/src/lib/version-contract.js +80 -0
  170. package/build/src/lib/version-contract.js.map +1 -0
  171. package/build/src/lib/version-strategy-migration.d.ts +6 -0
  172. package/build/src/lib/version-strategy-migration.d.ts.map +1 -0
  173. package/build/src/lib/version-strategy-migration.js +208 -0
  174. package/build/src/lib/version-strategy-migration.js.map +1 -0
  175. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  176. package/build/src/lib/workflow-templates.js +22 -1
  177. package/build/src/lib/workflow-templates.js.map +1 -1
  178. package/build/src/presets/eslint/dx-ignore.d.ts.map +1 -1
  179. package/build/src/presets/eslint/dx-ignore.js +7 -0
  180. package/build/src/presets/eslint/dx-ignore.js.map +1 -1
  181. package/build/src/types/api/app-store-connect.d.ts +427 -0
  182. package/build/src/types/api/google-play-console.d.ts +146 -0
  183. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +65 -0
  184. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +96 -12
  185. package/build/src/types/cli/index.d.ts +9 -32
  186. package/build/src/types/cli/integration/app-store-connect.d.ts +353 -0
  187. package/build/src/types/cli/integration/discord-developer-portal.d.ts +36 -0
  188. package/build/src/types/cli/integration/google-play-console.d.ts +145 -0
  189. package/build/src/types/cli/integration/index.d.ts +31 -0
  190. package/build/src/types/cli/recipe/index.d.ts +3 -1
  191. package/build/src/types/cli/recipe/miscellaneous/fix-markdown-tables.d.ts +26 -0
  192. package/build/src/types/cli/recipe/nova-config/normalize-order.d.ts +64 -0
  193. package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +19 -1
  194. package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +9 -0
  195. package/build/src/types/cli/utility/changelog.d.ts +149 -0
  196. package/build/src/types/cli/utility/configure.d.ts +219 -8
  197. package/build/src/types/cli/utility/run-recipes.d.ts +1 -8
  198. package/build/src/types/lib/constants.d.ts +7 -0
  199. package/build/src/types/lib/docker-packaging.d.ts +447 -47
  200. package/build/src/types/lib/integration.d.ts +264 -0
  201. package/build/src/types/lib/item.d.ts +4 -0
  202. package/build/src/types/lib/nova-config-order.d.ts +31 -0
  203. package/build/src/types/lib/nova-config.d.ts +40 -1
  204. package/build/src/types/lib/package-scripts.d.ts +2 -0
  205. package/build/src/types/lib/release-history.d.ts +15 -0
  206. package/build/src/types/lib/run-workspaces.d.ts +135 -0
  207. package/build/src/types/lib/scaffold-allow-scripts.d.ts +54 -0
  208. package/build/src/types/lib/scaffold.d.ts +157 -2
  209. package/build/src/types/lib/transpile.d.ts +2 -0
  210. package/build/src/types/lib/type-check.d.ts +28 -0
  211. package/build/src/types/lib/utility.d.ts +0 -13
  212. package/build/src/types/lib/version-contract.d.ts +84 -0
  213. package/build/src/types/lib/version-strategy-migration.d.ts +207 -0
  214. package/build/src/types/shared.d.ts +491 -3
  215. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +60 -0
  216. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +11 -0
  217. package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +65 -0
  218. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +4 -0
  219. package/build/src/types/tests/cli/integration.test.d.ts +97 -0
  220. package/build/src/types/tests/cli/recipe/nova-config/normalize-order.test.d.ts +31 -0
  221. package/build/src/types/tests/cli/recipe/package-json/normalize-tooling.test.d.ts +46 -25
  222. package/build/src/types/tests/cli/recipe/package-json/sync-identity-version-contract.test.d.ts +57 -0
  223. package/build/src/types/tests/cli/scaffold/app/android.test.d.ts +8 -0
  224. package/build/src/types/tests/cli/scaffold/app/apple.test.d.ts +6 -0
  225. package/build/src/types/tests/cli/scaffold/app/expressjs.test.d.ts +4 -0
  226. package/build/src/types/tests/cli/scaffold/docs/docusaurus.test.d.ts +26 -0
  227. package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +48 -0
  228. package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +72 -0
  229. package/build/src/types/tests/cli/utility/changelog.test.d.ts +20 -12
  230. package/build/src/types/tests/cli/utility/configure.test.d.ts +119 -0
  231. package/build/src/types/tests/cli/utility/run-recipes.test.d.ts +7 -56
  232. package/build/src/types/tests/cli/utility/run-scripts.test.d.ts +2 -0
  233. package/build/src/types/tests/cli/utility/run-workspaces.test.d.ts +48 -0
  234. package/build/src/types/tests/lib/docker-packaging.test.d.ts +169 -27
  235. package/build/src/types/tests/lib/ignore-files.test.d.ts +2 -0
  236. package/build/src/types/tests/lib/integration.test.d.ts +60 -0
  237. package/build/src/types/tests/lib/nova-config-run-workspaces-cache.test.d.ts +2 -2
  238. package/build/src/types/tests/lib/nova-config.test.d.ts +17 -0
  239. package/build/src/types/tests/lib/scaffold-allow-scripts.test.d.ts +14 -0
  240. package/build/src/types/tests/lib/scaffold-version-contract.test.d.ts +59 -0
  241. package/build/src/types/tests/lib/scaffold.test.d.ts +33 -0
  242. package/build/src/types/tests/lib/type-check.test.d.ts +26 -0
  243. package/build/src/types/tests/lib/utility.test.d.ts +21 -0
  244. package/build/src/types/tests/lib/version-contract.test.d.ts +66 -0
  245. package/build/src/types/tests/lib/version-strategy-migration.test.d.ts +85 -0
  246. package/build/src/types/tests/lib/workflow-templates.test.d.ts +4 -0
  247. package/build/src/types/tests/presets/eslint/dx-ignore.test.d.ts +14 -0
  248. package/build/src/types/tests/scaffold-output-contract.test.d.ts +26 -0
  249. package/build/templates/generators/must-haves/agent-conventions/PROJECT_RULES.md +107 -196
  250. package/build/templates/generators/must-haves/agent-conventions/VISION.md +91 -22
  251. package/build/templates/generators/must-haves/agent-conventions/conventions/docker.md +4 -4
  252. package/build/templates/generators/must-haves/agent-conventions/conventions/documentation.md +4 -2
  253. package/build/templates/scaffold/app/android/package.json +2 -2
  254. package/build/templates/scaffold/app/android/scripts/run-gradle.mjs +21 -4
  255. package/build/templates/scaffold/app/apple/eslint.config.mts +42 -0
  256. package/build/templates/scaffold/app/apple/package.json +11 -3
  257. package/build/templates/scaffold/app/apple/project.yml +1 -1
  258. package/build/templates/scaffold/app/apple/scripts/run-apple.mjs +2 -1
  259. package/build/templates/scaffold/app/apple/tsconfig.scripts.json +17 -0
  260. package/build/templates/scaffold/app/apple/tsconfig.tests.json +18 -0
  261. package/build/templates/scaffold/app/apple/vitest.config.mts +16 -0
  262. package/build/templates/scaffold/app/astro/package.json +2 -2
  263. package/build/templates/scaffold/app/discord-bot/package.json +2 -2
  264. package/build/templates/scaffold/app/express/package.json +2 -2
  265. package/build/templates/scaffold/app/nextjs/package.json +2 -2
  266. package/build/templates/scaffold/app/vite/package.json +2 -2
  267. package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +4 -3
  268. package/build/templates/scaffold/docs/docusaurus/eslint.config.mts +61 -3
  269. package/build/templates/scaffold/docs/docusaurus/package.json +6 -4
  270. package/build/templates/scaffold/docs/docusaurus/src/pages/index.tsx +2 -2
  271. package/build/templates/scaffold/docs/docusaurus/src/tests/dotenv.test.ts +27 -0
  272. package/build/templates/scaffold/docs/docusaurus/src/tests/frontmatter.test.ts +1 -1
  273. package/build/templates/scaffold/docs/docusaurus/src/tests/link.test.ts +1 -1
  274. package/build/templates/scaffold/docs/docusaurus/src/tests/markdown-table.test.ts +1 -1
  275. package/build/templates/scaffold/docs/docusaurus/src/tests/terminology.test.ts +1 -1
  276. package/build/templates/scaffold/docs/docusaurus/src/tests/type-declarations.test.ts +1 -1
  277. package/build/templates/scaffold/docs/docusaurus/src/types/pages/index.d.ts +2 -2
  278. package/build/templates/scaffold/docs/docusaurus/tsconfig.app.json +33 -0
  279. package/build/templates/scaffold/docs/docusaurus/tsconfig.config.json +21 -0
  280. package/build/templates/scaffold/docs/docusaurus/tsconfig.json +11 -17
  281. package/build/templates/scaffold/docs/docusaurus/tsconfig.tests.json +28 -0
  282. package/build/templates/scaffold/docs/docusaurus/vitest.config.mts +1 -14
  283. package/build/templates/scaffold/docs/docusaurus/vitest.setup.ts +3 -3
  284. package/build/templates/scaffold/package/github-action/package.json +2 -2
  285. package/build/templates/scaffold/package/homebridge/bin/repl.mjs +5 -2
  286. package/build/templates/scaffold/package/homebridge/bin/test-api.mjs +5 -2
  287. package/build/templates/scaffold/package/homebridge/package.json +2 -2
  288. package/build/templates/scaffold/package/pfsense/package.json +2 -2
  289. package/build/templates/scaffold/starter/base/assets/README.md +7 -0
  290. package/build/templates/scaffold-options/app/android-native/app/build.gradle.kts +1 -1
  291. package/build/templates/scaffold-options/app/android-native/gradlew.bat +84 -84
  292. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/creative-assets/README.md +10 -0
  293. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/metadata/ios/en-US.json +8 -0
  294. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/metadata/macos/en-US.json +8 -0
  295. package/build/templates/scaffold-options/app/apple-store-connect-root/assets/app-store-connect/[__WORKSPACE_NAME__]/screenshots/README.md +13 -0
  296. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/graphic-assets/README.md +12 -0
  297. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/metadata/android/en-US.json +6 -0
  298. package/build/templates/scaffold-options/app/google-play-console-root/assets/google-play-console/[__WORKSPACE_NAME__]/screenshots/README.md +13 -0
  299. package/build/templates/scaffold-options/docker-image/common/Dockerfile +81 -0
  300. package/build/templates/scaffold-options/docker-image/common/compose.yml +21 -0
  301. package/build/templates/scaffold-options/docker-image/common/dockerignore +38 -0
  302. package/build/templates/scaffold-options/package/node-cli-core/bin/cli.mjs +5 -2
  303. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +2 -2
  304. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +2 -2
  305. package/package.json +3 -2
  306. package/build/templates/scaffold-options/docker-image/astro-node/Dockerfile +0 -27
  307. package/build/templates/scaffold-options/docker-image/astro-node/compose.yml +0 -12
  308. package/build/templates/scaffold-options/docker-image/background-service/compose.yml +0 -10
  309. package/build/templates/scaffold-options/docker-image/container-native/Dockerfile +0 -10
  310. package/build/templates/scaffold-options/docker-image/container-native/compose.yml +0 -8
  311. package/build/templates/scaffold-options/docker-image/http-service/compose.yml +0 -11
  312. package/build/templates/scaffold-options/docker-image/nextjs-standalone/Dockerfile +0 -26
  313. package/build/templates/scaffold-options/docker-image/nextjs-standalone/compose.yml +0 -12
  314. package/build/templates/scaffold-options/docker-image/node/Dockerfile +0 -23
  315. package/build/templates/scaffold-options/docker-image/static-site/Dockerfile +0 -18
  316. 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;
@@ -183,6 +183,17 @@ export class Runner {
183
183
  else {
184
184
  workflow = Runner.buildPublish(entry, workspaces, environment, siblings, packageManager);
185
185
  }
186
+ const runsOn = entry['runsOn'];
187
+ const timeoutMinutes = entry['timeoutMinutes'];
188
+ for (const jobEntry of workflow['jobs']) {
189
+ const job = jobEntry;
190
+ if (runsOn !== undefined) {
191
+ job.runsOn = runsOn;
192
+ }
193
+ if (timeoutMinutes !== undefined) {
194
+ job.timeoutMinutes = timeoutMinutes;
195
+ }
196
+ }
186
197
  return Runner.serialize(workflow);
187
198
  }
188
199
  static serialize(workflow) {
@@ -465,6 +476,12 @@ export class Runner {
465
476
  const publishConditionParts = [];
466
477
  const runNameParts = [];
467
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
+ ];
468
485
  const dependsOn = [];
469
486
  for (const dependsOnTriggerValue of triggers) {
470
487
  const dependsOnTrigger = dependsOnTriggerValue;
@@ -562,15 +579,25 @@ export class Runner {
562
579
  Reflect.set(mergedPush, 'paths', mergedPaths);
563
580
  }
564
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
+ }
565
598
  mergedOn.push({
566
599
  event: 'workflow_dispatch',
567
- inputs: [{
568
- name: 'dry-run',
569
- description: 'Run without making changes',
570
- required: false,
571
- type: 'boolean',
572
- default: true,
573
- }],
600
+ inputs: dispatchInputs,
574
601
  });
575
602
  const publishCondition = [
576
603
  ...publishConditionParts.map((part) => ((part.includes('&&') === true) ? `(${part})` : part)),
@@ -602,16 +629,22 @@ export class Runner {
602
629
  const workspace = workspaces[scope];
603
630
  return workspace['name'];
604
631
  });
605
- const checkCommand = Runner.runScriptCommand(packageManager, 'check');
632
+ const checkCommand = Runner.buildScopeCommand('check', names, packageManager);
606
633
  const buildCommand = Runner.buildScopeCommand('build', names, packageManager);
607
634
  const steps = [
608
635
  {
609
636
  name: 'Checkout repository',
610
637
  uses: getScaffoldVersion('workflowActionCheckout'),
611
- with: [{
638
+ with: [
639
+ {
612
640
  key: 'fetch-depth',
613
641
  value: 0,
614
- }],
642
+ },
643
+ ...((hasWorkflowRunNode === true) ? [{
644
+ key: 'ref',
645
+ value: Runner.expr('github.event.workflow_run.head_sha'),
646
+ }] : []),
647
+ ],
615
648
  },
616
649
  {
617
650
  name: 'Setup Node.js',
@@ -656,13 +689,31 @@ export class Runner {
656
689
  runBlock: true,
657
690
  workingDirectory: Runner.expr('env.ROOT_DIR'),
658
691
  });
659
- steps.push({
660
- name: 'Build project',
661
- run: buildCommand,
662
- runBlock: true,
663
- workingDirectory: Runner.expr('env.ROOT_DIR'),
664
- });
665
- 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
+ }
666
717
  for (const target of targets) {
667
718
  const uploadTarget = target;
668
719
  const uploadMetadata = Variables.getTargetMetadata('publish', uploadTarget['to']);
@@ -694,6 +745,10 @@ export class Runner {
694
745
  };
695
746
  steps.push(uploadStep);
696
747
  }
748
+ if (hasContainerTarget === true) {
749
+ const containerArtifactSteps = Runner.buildContainerArtifactSteps(containerPlatforms);
750
+ steps.push(...containerArtifactSteps);
751
+ }
697
752
  const buildJob = {
698
753
  id: 'build',
699
754
  runsOn: 'ubuntu-latest',
@@ -707,10 +762,11 @@ export class Runner {
707
762
  for (const target of targets) {
708
763
  const deployTarget = target;
709
764
  const targetSettings = deployTarget['with'];
765
+ const isContainerTarget = deployTarget['to'] === 'docker-hub' || deployTarget['to'] === 'ghcr';
710
766
  const context = {
711
767
  workingDir: deployTarget['path'],
712
- artifactName: `build-${deployTarget['to']}-${Runner.slugifyWorkingDir(deployTarget['path'])}`,
713
- 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),
714
770
  targetSettings,
715
771
  workflowSettings,
716
772
  workspace: workspaces[deployTarget['path']],
@@ -745,6 +801,12 @@ export class Runner {
745
801
  jobs.push(Runner.buildVercelNextjsTarget(context));
746
802
  }
747
803
  }
804
+ const configuredTimeoutMinutes = entry['timeoutMinutes'];
805
+ if (configuredTimeoutMinutes !== undefined) {
806
+ for (const configuredJob of jobs) {
807
+ configuredJob.timeoutMinutes = configuredTimeoutMinutes;
808
+ }
809
+ }
748
810
  if (jobsCondition !== undefined) {
749
811
  for (const gatedJob of jobs) {
750
812
  Reflect.set(gatedJob, 'if', jobsCondition);
@@ -1152,9 +1214,13 @@ export class Runner {
1152
1214
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1153
1215
  const environment = context['environment'];
1154
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';
1155
1219
  return Runner.buildContainerRegistryTarget(context, {
1156
1220
  registrySlug: 'docker-hub',
1157
- imageTagPrefix: '',
1221
+ registryHost: 'docker.io',
1222
+ imageNamespace,
1223
+ imageRepository,
1158
1224
  loginStep: {
1159
1225
  name: 'Login to Docker Hub',
1160
1226
  uses: getScaffoldVersion('workflowActionDockerLogin'),
@@ -1174,7 +1240,6 @@ export class Runner {
1174
1240
  ],
1175
1241
  },
1176
1242
  extraPermissions: {},
1177
- attestationSubjectPrefix: 'docker.io/',
1178
1243
  });
1179
1244
  }
1180
1245
  static buildGhcrTarget(context) {
@@ -1182,9 +1247,12 @@ export class Runner {
1182
1247
  const workflowSettings = context['workflowSettings'];
1183
1248
  const metadata = Variables.getTargetMetadata('publish', 'ghcr');
1184
1249
  const variables = (metadata === undefined) ? {} : metadata['variables'];
1250
+ const imageRepository = (targetSettings === undefined) ? 'IMAGE_REPOSITORY' : targetSettings['IMAGE_REPOSITORY'] ?? 'IMAGE_REPOSITORY';
1185
1251
  return Runner.buildContainerRegistryTarget(context, {
1186
1252
  registrySlug: 'ghcr',
1187
- imageTagPrefix: 'ghcr.io/',
1253
+ registryHost: 'ghcr.io',
1254
+ imageNamespace: Runner.expr('github.repository_owner'),
1255
+ imageRepository,
1188
1256
  loginStep: {
1189
1257
  name: 'Login to GitHub Container Registry',
1190
1258
  uses: getScaffoldVersion('workflowActionDockerLogin'),
@@ -1195,7 +1263,7 @@ export class Runner {
1195
1263
  },
1196
1264
  {
1197
1265
  key: 'username',
1198
- value: Runner.expr('github.repository_owner'),
1266
+ value: Runner.expr('github.actor'),
1199
1267
  },
1200
1268
  {
1201
1269
  key: 'password',
@@ -1204,7 +1272,6 @@ export class Runner {
1204
1272
  ],
1205
1273
  },
1206
1274
  extraPermissions: { 'packages': 'write' },
1207
- attestationSubjectPrefix: 'ghcr.io/',
1208
1275
  });
1209
1276
  }
1210
1277
  static buildGithubPagesDocusaurusTarget(context) {
@@ -1599,18 +1666,95 @@ export class Runner {
1599
1666
  steps,
1600
1667
  };
1601
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
+ }
1602
1743
  static buildContainerRegistryTarget(context, config) {
1603
1744
  const registrySlug = config['registrySlug'];
1604
- const imageTagPrefix = config['imageTagPrefix'];
1745
+ const registryHost = config['registryHost'];
1746
+ const imageNamespace = config['imageNamespace'];
1747
+ const imageRepository = config['imageRepository'];
1605
1748
  const loginStep = config['loginStep'];
1606
1749
  const extraPermissions = config['extraPermissions'];
1607
- const attestationSubjectPrefix = config['attestationSubjectPrefix'];
1608
- const imageTags = [
1609
- `${imageTagPrefix}${Runner.expr('github.repository')}:latest`,
1610
- `${imageTagPrefix}${Runner.expr('github.repository')}:${Runner.expr('github.event.release.tag_name || \'manual\'')}`,
1611
- ].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\''));
1612
1756
  return {
1613
- id: `publish-${registrySlug}-${Runner.slugifyWorkingDir(context['workingDir'])}`,
1757
+ id: `publish-${registrySlug}-root`,
1614
1758
  needs: context['needs'],
1615
1759
  runsOn: 'ubuntu-latest',
1616
1760
  timeoutMinutes: 15,
@@ -1623,45 +1767,106 @@ export class Runner {
1623
1767
  },
1624
1768
  steps: [
1625
1769
  {
1626
- name: 'Checkout repository',
1627
- 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
+ ],
1628
1782
  },
1629
1783
  {
1630
- name: 'Set up QEMU',
1631
- uses: getScaffoldVersion('workflowActionDockerSetupQemu'),
1784
+ name: 'Set up ORAS',
1785
+ uses: getScaffoldVersion('workflowActionSetupOras'),
1632
1786
  with: [{
1633
- key: 'platforms',
1634
- value: 'linux/amd64,linux/arm64',
1787
+ key: 'version',
1788
+ value: '1.3.3',
1635
1789
  }],
1636
1790
  },
1637
1791
  {
1638
- name: 'Set up Docker Buildx',
1639
- uses: getScaffoldVersion('workflowActionDockerSetupBuildx'),
1640
- },
1641
- loginStep,
1642
- {
1643
- name: 'Build and push',
1644
- id: 'build-push',
1645
- uses: getScaffoldVersion('workflowActionDockerBuildPush'),
1646
- with: [
1792
+ name: 'Resolve image coordinate and tags',
1793
+ env: [
1794
+ {
1795
+ key: 'EVENT_NAME',
1796
+ value: Runner.expr('github.event_name'),
1797
+ },
1798
+ {
1799
+ key: 'IMAGE_NAMESPACE',
1800
+ value: imageNamespace,
1801
+ },
1647
1802
  {
1648
- key: 'context',
1649
- value: context['workingDir'],
1803
+ key: 'IMAGE_REPOSITORY',
1804
+ value: imageRepository,
1650
1805
  },
1651
1806
  {
1652
- key: 'platforms',
1653
- value: 'linux/amd64,linux/arm64',
1807
+ key: 'MANUAL_TAG',
1808
+ value: Runner.expr('inputs.tag || \'\''),
1654
1809
  },
1655
1810
  {
1656
- key: 'push',
1811
+ key: 'PUBLISH',
1657
1812
  value: Runner.expr('env.PUBLISH'),
1658
1813
  },
1659
1814
  {
1660
- key: 'tags',
1661
- value: imageTags,
1662
- 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 || \'\''),
1663
1841
  },
1664
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,
1665
1870
  },
1666
1871
  {
1667
1872
  name: 'Generate build provenance',
@@ -1670,11 +1875,11 @@ export class Runner {
1670
1875
  with: [
1671
1876
  {
1672
1877
  key: 'subject-name',
1673
- value: `${attestationSubjectPrefix}${Runner.expr('github.repository')}`,
1878
+ value: Runner.expr('env.IMAGE'),
1674
1879
  },
1675
1880
  {
1676
1881
  key: 'subject-digest',
1677
- value: Runner.expr('steps.build-push.outputs.digest'),
1882
+ value: Runner.expr('env.IMAGE_DIGEST'),
1678
1883
  },
1679
1884
  {
1680
1885
  key: 'push-to-registry',
@@ -1682,12 +1887,217 @@ export class Runner {
1682
1887
  },
1683
1888
  ],
1684
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
+ },
1685
1895
  ],
1686
1896
  };
1687
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
+ }
1688
2097
  static buildScopeCommand(scriptName, workspaceNames, packageManager) {
1689
- const workspaceFlags = workspaceNames.map((workspaceName) => `--workspace ${workspaceName}`).join(' ');
1690
- 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}`;
1691
2101
  }
1692
2102
  static corepackDownloadCommand(packageManager, packageName, commandArguments) {
1693
2103
  if (packageManager === 'npm') {