Skip to content

Commit e94c457

Browse files
committed
build: set cosign version and verify commands as outputs
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent a08e9ad commit e94c457

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ on:
108108
github-token:
109109
description: "GitHub Token used to authenticate against a repository for Git context"
110110
required: false
111+
outputs:
112+
cosign-version:
113+
description: Cosign version used for verification
114+
value: ${{ jobs.build.outputs.cosign-version }}
115+
cosign-verify-commands:
116+
description: Cosign verify commands
117+
value: ${{ jobs.build.outputs.cosign-verify-commands }}
111118

112119
env:
113120
DOCKER_ACTIONS_TOOLKIT_MODULE: "@docker/actions-toolkit@0.67.0"
@@ -117,6 +124,9 @@ env:
117124
jobs:
118125
build:
119126
runs-on: ubuntu-latest
127+
outputs:
128+
cosign-version: ${{ env.COSIGN_VERSION }}
129+
cosign-verify-commands: ${{ steps.signing-attestation-manifests.outputs.verify-commands || steps.signing-local-artifacts.outputs.verify-commands }}
120130
permissions:
121131
contents: read
122132
id-token: write # needed for signing the images with GitHub OIDC Token
@@ -264,6 +274,7 @@ jobs:
264274
await cosign.printVersion();
265275
-
266276
name: Signing attestation manifests
277+
id: signing-attestation-manifests
267278
if: ${{ inputs.build-output == 'registry' }}
268279
uses: actions/github-script@v8
269280
env:
@@ -286,8 +297,19 @@ jobs:
286297
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
287298
signResults
288299
);
300+
301+
await core.group(`Verify commands`, async () => {
302+
const verifyCommands = [];
303+
for (const [attestationRef, verifyResult] of Object.entries(verifyResults)) {
304+
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} ${attestationRef}`;
305+
core.info(cmd);
306+
verifyCommands.push(cmd);
307+
}
308+
core.setOutput('verify-commands', verifyCommands.join('\n'));
309+
});
289310
-
290311
name: Signing local artifacts
312+
id: signing-local-artifacts
291313
if: ${{ inputs.build-output == 'local' }}
292314
uses: actions/github-script@v8
293315
env:
@@ -307,6 +329,16 @@ jobs:
307329
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
308330
signResults
309331
);
332+
333+
await core.group(`Verify commands`, async () => {
334+
const verifyCommands = [];
335+
for (const [artifactPath, verifyResult] of Object.entries(verifyResults)) {
336+
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} --bundle ${path.relative(inplocalExportDir, verifyResult.bundlePath)} ${path.relative(inplocalExportDir, artifactPath)}`;
337+
core.info(cmd);
338+
verifyCommands.push(cmd);
339+
}
340+
core.setOutput('verify-commands', verifyCommands.join('\n'));
341+
});
310342
-
311343
name: Create manifest
312344
if: ${{ inputs.build-output == 'registry' }}

0 commit comments

Comments
 (0)