Skip to content

Commit 94607cc

Browse files
committed
ci: sign images
Signed-off-by: Moritz Wanzenböck <moritz.wanzenboeck@linbit.com>
1 parent a237996 commit 94607cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/build-docker.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
jobs:
1515
build-and-push:
1616
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write
1719
steps:
1820
- uses: actions/checkout@v5
1921
- name: Set up QEMU
@@ -23,6 +25,9 @@ jobs:
2325
- name: Set up Docker Buildx
2426
id: buildx
2527
uses: docker/setup-buildx-action@v3
28+
- name: Set up cosign
29+
if: ${{ github.event_name != 'pull_request' }}
30+
uses: sigstore/cosign-installer@v3
2631
- name: login to Docker Hub
2732
if: ${{ github.event_name != 'pull_request' }}
2833
uses: docker/login-action@v3
@@ -38,6 +43,7 @@ jobs:
3843
password: ${{ secrets.QUAYIO_PASSWORD }}
3944
- name: Build and push
4045
uses: docker/bake-action@v6
46+
id: bake
4147
with:
4248
builder: ${{ steps.buildx.outputs.name }}
4349
source: .
@@ -48,3 +54,8 @@ jobs:
4854
env:
4955
GIT_COMMIT: ${{ github.sha }}
5056
CACHE: true
57+
- name: Sign images
58+
if: ${{ github.event_name != 'pull_request' }}
59+
run: |
60+
jq '.[] | select(type=="object") | select(."containerimage.digest") | ."containerimage.digest" as $DIGEST | ."image.name" | split(":")[0] | "\(.)@\($DIGEST)"' -r <<<'${{ steps.bake.outputs.metadata }}' \
61+
| xargs --no-run-if-emtpy cosign sign --yes

0 commit comments

Comments
 (0)