Skip to content

Commit

Permalink
fix signing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xStuart committed Feb 5, 2024
1 parent 068fb88 commit e894756
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
board:
- milkv-duo
# - milkv-duo
# - milkv-duo-lite
- milkv-duo256m
# - milkv-duo256m-lite
Expand Down Expand Up @@ -62,19 +62,33 @@ jobs:
type=sha
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: BOARD=${{ matrix.board }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
run: |
TAGS="${{ steps.meta.outputs.tags }}"
DIGEST="${{ steps.build-and-push.outputs.digest }}"
if [[ -n "$DIGEST" ]]; then
# Sign by digest
echo "Signing by digest"
cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@$DIGEST
elif [[ -n "$TAGS" ]]; then
# Sign by tags
echo "Signing by tags"
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"
for tag in "${TAG_ARRAY[@]}"; do
cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$tag
done
else
echo "No tags or digest available for signing"
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
COSIGN_EXPERIMENTAL: "true"

0 comments on commit e894756

Please sign in to comment.