@@ -25,6 +25,7 @@ import { HELM_CHARTS } from "./homelab-helm.ts";
2525import { Stage } from "./lib-types.ts" ;
2626import type { StepResult , HelmBuildResult , HomelabSecrets } from "./homelab-index.ts" ;
2727import { homelabTestHelm , homelabTestRenovateRegex , homelabHelmBuild } from "./homelab-index.ts" ;
28+ import { formatVersionWithDigest } from "./lib-ghcr.ts" ;
2829import { planAll } from "./homelab-tofu.ts" ;
2930import versions from "./lib-versions.ts" ;
3031
@@ -216,6 +217,7 @@ type PublishResults = {
216217 caddyS3ProxyPublishResult : StepResult ;
217218 helmPublishResult : StepResult ;
218219 syncResult : StepResult ;
220+ infraVersions : Record < string , string > ;
219221} ;
220222
221223type HelmPublishOptions = {
@@ -302,6 +304,7 @@ export async function runPublishPhase(
302304 status : "skipped" ,
303305 message : "[SKIPPED] Not prod or chart publish failed" ,
304306 } ,
307+ infraVersions : { } ,
305308 } ;
306309 }
307310
@@ -319,7 +322,7 @@ export async function runPublishPhase(
319322 haResults ,
320323 depSummaryResults ,
321324 dnsAuditResults ,
322- caddyS3ProxyResult ,
325+ caddyS3ProxyResults ,
323326 helmResult ,
324327 ] = await Promise . all ( [
325328 Promise . all ( [
@@ -368,23 +371,20 @@ export async function runPublishPhase(
368371 false ,
369372 ) ,
370373 ] ) ,
371- ( async ( ) : Promise < StepResult > => {
372- const [ versioned , latest ] = await Promise . all ( [
373- buildAndPushCaddyS3ProxyImage (
374- `ghcr.io/shepherdjerred/caddy-s3proxy:${ chartVersion } ` ,
375- ghcrUsername ,
376- ghcrPassword ,
377- false ,
378- ) ,
379- buildAndPushCaddyS3ProxyImage (
380- `ghcr.io/shepherdjerred/caddy-s3proxy:latest` ,
381- ghcrUsername ,
382- ghcrPassword ,
383- false ,
384- ) ,
385- ] ) ;
386- return combinePublishResults ( [ versioned , latest ] ) ;
387- } ) ( ) ,
374+ Promise . all ( [
375+ buildAndPushCaddyS3ProxyImage (
376+ `ghcr.io/shepherdjerred/caddy-s3proxy:${ chartVersion } ` ,
377+ ghcrUsername ,
378+ ghcrPassword ,
379+ false ,
380+ ) ,
381+ buildAndPushCaddyS3ProxyImage (
382+ `ghcr.io/shepherdjerred/caddy-s3proxy:latest` ,
383+ ghcrUsername ,
384+ ghcrPassword ,
385+ false ,
386+ ) ,
387+ ] ) ,
388388 helmBuildResult . dist
389389 ? homelabHelmPublishBuilt ( {
390390 builtDist : helmBuildResult . dist ,
@@ -401,6 +401,20 @@ export async function runPublishPhase(
401401
402402 const helmPublishResult = helmResult ;
403403
404+ // Extract digests from versioned-tag results (index [0] of each pair)
405+ const infraVersions : Record < string , string > = { } ;
406+ const infraMapping : [ string , StepResult ] [ ] = [
407+ [ "shepherdjerred/homelab" , haResults [ 0 ] ] ,
408+ [ "shepherdjerred/dependency-summary" , depSummaryResults [ 0 ] ] ,
409+ [ "shepherdjerred/dns-audit" , dnsAuditResults [ 0 ] ] ,
410+ [ "shepherdjerred/caddy-s3proxy" , caddyS3ProxyResults [ 0 ] ] ,
411+ ] ;
412+ for ( const [ key , result ] of infraMapping ) {
413+ if ( result . status === "passed" && result . publishRef !== undefined ) {
414+ infraVersions [ key ] = formatVersionWithDigest ( chartVersion , result . publishRef ) ;
415+ }
416+ }
417+
404418 let syncResult : StepResult = {
405419 status : "skipped" ,
406420 message : "[SKIPPED] Not prod or chart publish failed" ,
@@ -413,9 +427,10 @@ export async function runPublishPhase(
413427 haPublishResult : combinePublishResults ( haResults ) ,
414428 depSummaryPublishResult : combinePublishResults ( depSummaryResults ) ,
415429 dnsAuditPublishResult : combinePublishResults ( dnsAuditResults ) ,
416- caddyS3ProxyPublishResult : caddyS3ProxyResult ,
430+ caddyS3ProxyPublishResult : combinePublishResults ( caddyS3ProxyResults ) ,
417431 helmPublishResult,
418432 syncResult,
433+ infraVersions,
419434 } ;
420435}
421436
0 commit comments