Skip to content

Commit 724f2ce

Browse files
committed
build: show image manifest
Signed-off-by: CrazyMax <[email protected]>
1 parent 2235615 commit 724f2ce

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,31 @@ jobs:
124124
annotations: ${{ inputs.set-meta-annotations && steps.meta.outputs.annotations || '' }}
125125
github-token: ${{ secrets.github-token || github.token }}
126126
-
127-
name: Get attestations digest
127+
name: Get attestations manifest digest
128128
id: attest
129129
uses: actions/github-script@v7
130130
env:
131131
INPUT_IMAGE-NAME: ${{ inputs.meta-image }}
132132
INPUT_IMAGE-DIGEST: ${{ steps.build.outputs.digest }}
133133
with:
134134
script: |
135-
await core.group(`Get attestations digest`, async () => {
135+
let manifest = {};
136+
await core.group(`Get manifest`, async () => {
136137
await exec.getExecOutput('docker', ['buildx', 'imagetools', 'inspect', `${core.getInput('image-name')}@${core.getInput('image-digest')}`, '--format', '{{json .Manifest}}'], {
137-
ignoreReturnCode: true,
138-
silent: true
138+
ignoreReturnCode: true
139139
}).then(res => {
140140
if (res.stderr.length > 0 && res.exitCode != 0) {
141141
throw new Error(res.stderr);
142142
}
143-
const dt = JSON.parse(res.stdout.trim());
144-
const attestationDigests = dt.manifests.filter(m => m.annotations && m.annotations['vnd.docker.reference.type'] === 'attestation-manifest').map(m => m.digest);
145-
core.info(JSON.stringify(attestationDigests, null, 2));
146-
core.setOutput('digests', attestationDigests.join('\n'));
143+
manifest = JSON.parse(res.stdout.trim());
144+
core.info(JSON.stringify(manifest, null, 2));
147145
});
148146
});
147+
await core.group(`Get attestations manifest digest`, async () => {
148+
const attestationDigests = manifest.manifests.filter(m => m.annotations && m.annotations['vnd.docker.reference.type'] === 'attestation-manifest').map(m => m.digest);
149+
core.info(JSON.stringify(attestationDigests, null, 2));
150+
core.setOutput('digests', attestationDigests.join('\n'));
151+
});
149152
-
150153
name: Install cosign
151154
if: ${{ inputs.push }}

0 commit comments

Comments
 (0)