Skip to content

Commit 50dc20a

Browse files
committed
verify: use the actions-toolkit to install cosign
Signed-off-by: CrazyMax <[email protected]>
1 parent e9da64b commit 50dc20a

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/verify.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
description: "Registry authentication details as YAML objects"
1313
required: false
1414

15+
env:
16+
DOCKER_ACTIONS_TOOLKIT_MODULE: "@docker/[email protected]"
17+
1518
jobs:
1619
verify:
1720
runs-on: ubuntu-24.04
@@ -44,12 +47,37 @@ jobs:
4447
core.setOutput('artifact-name', artifactName);
4548
core.setOutput('output-type', outputType);
4649
core.setOutput('signed', signed);
50+
-
51+
name: Install @docker/actions-toolkit
52+
if: ${{ steps.vars.outputs.signed == 'true' }}
53+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
54+
env:
55+
INPUT_DAT-MODULE: ${{ env.DOCKER_ACTIONS_TOOLKIT_MODULE }}
56+
with:
57+
script: |
58+
await exec.exec('npm', ['install', '--prefer-offline', '--ignore-scripts', core.getInput('dat-module')]);
4759
-
4860
name: Install Cosign
4961
if: ${{ steps.vars.outputs.signed == 'true' }}
50-
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
62+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
63+
env:
64+
INPUT_COSIGN-VERSION: ${{ steps.vars.outputs.cosign-version }}
5165
with:
52-
cosign-release: ${{ steps.vars.outputs.cosign-version }}
66+
script: |
67+
const { Cosign } = require('@docker/actions-toolkit/lib/cosign/cosign');
68+
const { Install } = require('@docker/actions-toolkit/lib/cosign/install');
69+
70+
const cosignInstall = new Install();
71+
const cosignBinPath = await cosignInstall.download({
72+
version: core.getInput('cosign-version'),
73+
ghaNoCache: true,
74+
skipState: true,
75+
verifySignature: true
76+
});
77+
await cosignInstall.install(cosignBinPath);
78+
79+
const cosign = new Cosign();
80+
await cosign.printVersion();
5381
-
5482
name: Login to registry
5583
if: ${{ steps.vars.outputs.signed == 'true' && steps.vars.outputs.output-type == 'image' }}

0 commit comments

Comments
 (0)