Skip to content

Commit 9bff5a2

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 ec89399 commit 9bff5a2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.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
@@ -266,6 +276,7 @@ jobs:
266276
await cosign.printVersion();
267277
-
268278
name: Signing attestation manifests
279+
id: signing-attestation-manifests
269280
if: ${{ inputs.output == 'registry' }}
270281
uses: actions/github-script@v8
271282
env:
@@ -288,8 +299,19 @@ jobs:
288299
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
289300
signResults
290301
);
302+
303+
await core.group(`Verify commands`, async () => {
304+
const verifyCommands = [];
305+
for (const [attestationRef, verifyResult] of Object.entries(verifyResults)) {
306+
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} ${attestationRef}`;
307+
core.info(cmd);
308+
verifyCommands.push(cmd);
309+
}
310+
core.setOutput('verify-commands', verifyCommands.join('\n'));
311+
});
291312
-
292313
name: Signing local artifacts
314+
id: signing-local-artifacts
293315
if: ${{ inputs.output == 'local' }}
294316
uses: actions/github-script@v8
295317
env:
@@ -309,6 +331,16 @@ jobs:
309331
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
310332
signResults
311333
);
334+
335+
await core.group(`Verify commands`, async () => {
336+
const verifyCommands = [];
337+
for (const [artifactPath, verifyResult] of Object.entries(verifyResults)) {
338+
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} --bundle ${path.relative(inplocalExportDir, verifyResult.bundlePath)} ${path.relative(inplocalExportDir, artifactPath)}`;
339+
core.info(cmd);
340+
verifyCommands.push(cmd);
341+
}
342+
core.setOutput('verify-commands', verifyCommands.join('\n'));
343+
});
312344
-
313345
name: Create manifest
314346
if: ${{ inputs.output == 'registry' }}

0 commit comments

Comments
 (0)