diff --git a/.github/workflows/docker-package-publish.yml b/.github/workflows/docker-package-publish.yml index 93409e4..8e10ac3 100644 --- a/.github/workflows/docker-package-publish.yml +++ b/.github/workflows/docker-package-publish.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Ensure repository/image name is lowercase for Docker registry - name: Set lowercase image name @@ -181,3 +181,18 @@ jobs: - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ steps.image.outputs.lower }}:${{ steps.meta.outputs.version }} + + # Install cosign (before using it) + - name: Install cosign + uses: sigstore/cosign-installer@v3.7.0 + with: + cosign-release: 'v2.2.4' + + # Sign the pushed image by digest (skip on PRs) + - name: Sign image with cosign + if: github.event_name != 'pull_request' + env: + DIGEST: ${{ steps.create-manifest.outputs.digest }} + TAGS: ${{ steps.meta.outputs.tags }} + run: | + echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}