Skip to content

signed container v4 #13

signed container v4

signed container v4 #13

Workflow file for this run

name: ci
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token
steps:
- uses: actions/checkout@v4
- uses: docker/metadata-action@v5
id: docker_meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
id: build_and_push
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- uses: sigstore/cosign-installer@v3
- name: Sign the images with GitHub OIDC Token
if: github.event_name != 'pull_request'
env:
DIGEST: ${{ steps.build_and_push.outputs.digest }}
TAGS: ${{ steps.docker_meta.outputs.tags }}
run: |
images=""
for tag in ${TAGS}; do
images+="${tag}@${DIGEST} "
done
cosign sign --yes ${images}