Skip to content

Commit

Permalink
avoid using jq for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Sep 17, 2024
1 parent 9b0dfe3 commit 53fc1e7
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/builder-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,33 +117,25 @@ jobs:
type=raw,value=latest
type=sha,format=long
- name: Create and push manifest list
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
# Extract tags using jq and ensure proper formatting
TAGS=$(jq -cr '.tags[] | "-t " + .' <<< "${{ steps.meta.outputs.json }}")
# Check if TAGS is empty
if [ -z "$TAGS" ]; then
echo "No tags found in JSON output."
exit 1
fi
# Create a manifest list using the image digests from /tmp/digests/*
DIGESTS=$(for file in /tmp/digests/*; do
echo -n "${{ env.REGISTRY_IMAGE }}@$(cat $file) "
done)
- name: Create and push manifest list
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
# Extract tags
TAGS=$(echo '${{ steps.meta.outputs.tags }}' | xargs -I {} echo "-t {}")
# Verify DIGESTS is not empty
if [ -z "$DIGESTS" ]; then
echo "No digests found."
exit 1
fi
# Create a manifest list using the image digests from /tmp/digests/*
DIGESTS=$(for file in /tmp/digests/*; do
echo -n "${{ env.REGISTRY_IMAGE }}@$(cat $file) "
done)
# Create the manifest list with the collected tags and digests
docker buildx imagetools create $TAGS $DIGESTS
# Create the manifest list with the collected tags and digests
docker buildx imagetools create $TAGS $DIGESTS
# Push to GitHub Container Registry
GHCR_TAGS=$(echo '${{ steps.meta.outputs.tags }}' | sed 's|^|ghcr.io/${{ github.repository_owner }}/${{ env.REGISTRY_IMAGE }}:|g' | xargs -I {} echo "-t {}")
docker buildx imagetools create $GHCR_TAGS $DIGESTS
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit 53fc1e7

Please sign in to comment.