1919 default : default
2020 output :
2121 type : string
22- description : " Build output destination (one of cacheonly, registry, local)"
23- default : ' cacheonly'
24- required : false
22+ description : " Build output destination (image or local)"
23+ required : true
2524 artifact-name :
2625 type : string
2726 description : " Name of the uploaded artifact (for local output)"
3130 type : string
3231 description : " Environment variables to set"
3332 required : false
33+ push :
34+ type : boolean
35+ description : " Push image to the registry (for image output) and/or sign attestation manifests or local artifacts"
36+ required : false
37+ default : false
3438 cache :
3539 type : boolean
3640 description : " Enable cache to GitHub Actions cache backend"
@@ -314,7 +318,7 @@ jobs:
314318 -
315319 name : Docker meta
316320 id : meta
317- if : ${{ inputs.output == 'registry ' }}
321+ if : ${{ inputs.output == 'image ' }}
318322 uses : docker/metadata-action@v5
319323 with :
320324 images : ${{ inputs.meta-images }}
@@ -345,6 +349,7 @@ jobs:
345349 INPUT_CONTEXT : ${{ inputs.context }}
346350 INPUT_TARGET : ${{ inputs.target }}
347351 INPUT_OUTPUT : ${{ inputs.output }}
352+ INPUT_PUSH : ${{ inputs.push }}
348353 INPUT_CACHE : ${{ inputs.cache }}
349354 INPUT_CACHE-SCOPE : ${{ inputs.cache-scope }}
350355 INPUT_CACHE-MODE : ${{ inputs.cache-mode }}
@@ -375,6 +380,7 @@ jobs:
375380 const inpContext = core.getInput('context');
376381 const inpTarget = core.getInput('target');
377382 const inpOutput = core.getInput('output');
383+ const inpPush = core.getBooleanInput('push');
378384 const inpCache = core.getBooleanInput('cache');
379385 const inpCacheScope = core.getInput('cache-scope');
380386 const inpCacheMode = core.getInput('cache-mode');
@@ -441,14 +447,11 @@ jobs:
441447
442448 let outputOverride = '';
443449 switch (inpOutput) {
444- case 'cacheonly':
445- outputOverride = '*.output=type=cacheonly';
446- break;
447- case 'registry':
450+ case 'image':
448451 if (inpMetaImages.length == 0) {
449452 core.setFailed('meta-images is required when output is registry');
450453 }
451- outputOverride = `*.output=type=registry ,"name=${inpMetaImages.join(',')}",oci-artifact=true,push-by-digest=true,name-canonical=true`;
454+ outputOverride = `*.output=type=image ,"name=${inpMetaImages.join(',')}",oci-artifact=true,push-by-digest=true,name-canonical=true,push=${inpPush} `;
452455 break;
453456 case 'local':
454457 outputOverride = `*.output=type=local,platform-split=true,dest=${inpLocalExportDir}`;
@@ -472,7 +475,7 @@ jobs:
472475 });
473476 -
474477 name : Login to registry
475- if : ${{ inputs.output == 'registry ' }}
478+ if : ${{ inputs.push && inputs. output == 'image ' }}
476479 # TODO: switch to docker/login-action when OIDC is supported
477480 uses : crazy-max/docker-login-action@dockerhub-oidc
478481 with :
@@ -495,7 +498,7 @@ jobs:
495498 -
496499 name : Get image digest
497500 id : get-image-digest
498- if : ${{ inputs.output == 'registry ' }}
501+ if : ${{ inputs.push && inputs. output == 'image ' }}
499502 uses : actions/github-script@v8
500503 env :
501504 INPUT_TARGET : ${{ steps.prepare.outputs.target }}
@@ -509,7 +512,7 @@ jobs:
509512 core.setOutput('digest', imageDigest);
510513 -
511514 name : Install Cosign
512- if : ${{ inputs.output != 'cacheonly' }}
515+ if : ${{ inputs.push }}
513516 uses : actions/github-script@v8
514517 env :
515518 INPUT_COSIGN-VERSION : ${{ env.COSIGN_VERSION }}
@@ -527,7 +530,7 @@ jobs:
527530 -
528531 name : Signing attestation manifests
529532 id : signing-attestation-manifests
530- if : ${{ inputs.output == 'registry ' }}
533+ if : ${{ inputs.push && inputs. output == 'image ' }}
531534 uses : actions/github-script@v8
532535 env :
533536 INPUT_IMAGE-NAMES : ${{ inputs.meta-images }}
@@ -562,7 +565,7 @@ jobs:
562565 -
563566 name : Signing local artifacts
564567 id : signing-local-artifacts
565- if : ${{ inputs.output == 'local' }}
568+ if : ${{ inputs.push && inputs. output == 'local' }}
566569 uses : actions/github-script@v8
567570 env :
568571 INPUT_LOCAL-OUTPUT-DIR : ${{ env.LOCAL_EXPORT_DIR }}
@@ -646,7 +649,7 @@ jobs:
646649 -
647650 name : Docker meta
648651 id : meta
649- if : ${{ inputs.output == 'registry ' }}
652+ if : ${{ inputs.output == 'image ' }}
650653 uses : docker/metadata-action@v5
651654 with :
652655 images : ${{ inputs.meta-images }}
@@ -657,21 +660,21 @@ jobs:
657660 bake-target : ${{ inputs.meta-bake-target }}
658661 -
659662 name : Login to registry
660- if : ${{ inputs.output == 'registry ' }}
663+ if : ${{ inputs.push && inputs. output == 'image ' }}
661664 # TODO: switch to docker/login-action when OIDC is supported
662665 uses : crazy-max/docker-login-action@dockerhub-oidc
663666 with :
664667 registry-auth : ${{ secrets.registry-auths }}
665668 -
666669 name : Set up Docker Buildx
667- if : ${{ inputs.output == 'registry ' }}
670+ if : ${{ inputs.push && inputs. output == 'image ' }}
668671 uses : docker/setup-buildx-action@v3
669672 with :
670673 version : latest
671674 buildkitd-flags : --debug
672675 -
673676 name : Create manifest
674- if : ${{ inputs.output == 'registry ' }}
677+ if : ${{ inputs.push && inputs. output == 'image ' }}
675678 uses : actions/github-script@v8
676679 env :
677680 INPUT_IMAGE-NAMES : ${{ inputs.meta-images }}
@@ -713,7 +716,6 @@ jobs:
713716 -
714717 name : Set outputs
715718 id : set
716- if : ${{ inputs.output != 'cacheonly' }}
717719 uses : actions/github-script@v8
718720 env :
719721 INPUT_BUILD-OUTPUTS : ${{ toJSON(needs.build.outputs) }}
0 commit comments