@@ -801,12 +801,38 @@ jobs:
801801 INPUT_IMAGE-NAMES : ${{ inputs.meta-images }}
802802 INPUT_TAG-NAMES : ${{ steps.meta.outputs.tag-names }}
803803 INPUT_BUILD-OUTPUTS : ${{ toJSON(needs.build.outputs) }}
804+ INPUT_ANNOTATIONS : ${{ inputs.annotations }}
805+ INPUT_SET-META-ANNOTATIONS : ${{ inputs.set-meta-annotations }}
806+ INPUT_META-ANNOTATIONS : ${{ steps.meta.outputs.annotations }}
804807 with :
805808 script : |
806809 const inpPush = core.getBooleanInput('push');
807810 const inpImageNames = core.getMultilineInput('image-names');
808811 const inpTagNames = core.getMultilineInput('tag-names');
809812 const inpBuildOutputs = JSON.parse(core.getInput('build-outputs'));
813+ const inpAnnotations = core.getMultilineInput('annotations');
814+ const inpSetMetaAnnotations = core.getBooleanInput('set-meta-annotations');
815+ const inpMetaAnnotations = core.getMultilineInput('meta-annotations');
816+
817+ const toIndexAnnotation = annotation => {
818+ const keyEnd = annotation.indexOf('=');
819+ const rawKey = keyEnd === -1 ? annotation : annotation.substring(0, keyEnd);
820+ const rawValue = keyEnd === -1 ? '' : annotation.substring(keyEnd);
821+ const typeSeparator = rawKey.indexOf(':');
822+ if (typeSeparator !== -1) {
823+ const typeExpr = rawKey.substring(0, typeSeparator);
824+ const key = rawKey.substring(typeSeparator + 1);
825+ const hasKnownType = typeExpr.split(',').map(type => type.replace(/\[.*\]$/, '')).some(type => ['manifest', 'index', 'manifest-descriptor', 'index-descriptor'].includes(type));
826+ if (hasKnownType) {
827+ return `index:${key}${rawValue}`;
828+ }
829+ }
830+ return `index:${annotation}`;
831+ };
832+ if (inpSetMetaAnnotations && inpMetaAnnotations.length > 0) {
833+ inpAnnotations.push(...inpMetaAnnotations);
834+ }
835+ const indexAnnotations = inpAnnotations.filter(annotation => annotation.length > 0).map(toIndexAnnotation);
810836
811837 const digests = [];
812838 for (const key of Object.keys(inpBuildOutputs)) {
@@ -825,6 +851,9 @@ jobs:
825851 for (const tag of inpTagNames) {
826852 createArgs.push('-t', `${imageName}:${tag}`);
827853 }
854+ for (const annotation of indexAnnotations) {
855+ createArgs.push('--annotation', annotation);
856+ }
828857 for (const digest of digests) {
829858 createArgs.push(digest);
830859 }
0 commit comments