Skip to content

Commit

Permalink
Update docker-publish.yml
Browse files Browse the repository at this point in the history
Obtain DIGEST for signing
  • Loading branch information
martijndeb authored Jan 5, 2024
1 parent b2eb057 commit 5bdf400
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ jobs:

- name: Build and push Docker image
id: build-and-push
run: docker-compose build && docker-compose push
run: |
docker-compose build
DOCKER_IMAGE=$(docker-compose images --format "{{.Repository}}:{{.Tag}}")
docker-compose push
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${DOCKER_IMAGE})
echo "DIGEST=${DIGEST}" >> $GITHUB_ENV
env:
DOCKER_BUILDKIT: 1

- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
DIGEST: ${{ env.DIGEST }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 comments on commit 5bdf400

Please sign in to comment.