Skip to content

Commit 369d792

Browse files
author
Sai Sanjay
committed
Fix CI: remove OCI output, use imageid/digest for image size
1 parent c4d1ad6 commit 369d792

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,16 @@ jobs:
5757
labels: ${{ steps.meta.outputs.labels }}
5858
cache-from: type=gha
5959
cache-to: type=gha,mode=max
60-
outputs: type=oci,dest=/tmp/image.tar
6160

6261
- name: Get image size
6362
id: image-size
63+
if: github.event_name != 'pull_request'
6464
run: |
65-
# Load the image from the build step output
66-
docker load < /tmp/image.tar
67-
# Get the image ID from the loaded image
68-
IMAGE_ID=$(docker images --format "{{.ID}}" | head -n 1)
69-
echo "Using image ID: $IMAGE_ID"
70-
# Get the image size
71-
SIZE=$(docker image inspect $IMAGE_ID --format='{{.Size}}')
65+
DIGEST="${{ steps.build-push.outputs.digest }}"
66+
IMAGE="ghcr.io/${{ github.repository }}@${DIGEST}"
67+
echo "Inspecting image: $IMAGE"
68+
MANIFEST=$(docker buildx imagetools inspect --raw "$IMAGE")
69+
SIZE=$(echo "$MANIFEST" | jq '[.manifests[].size] | add')
7270
SIZE_MB=$(echo "scale=2; $SIZE/1024/1024" | bc)
7371
echo "size=$SIZE_MB MB" >> $GITHUB_OUTPUT
7472
echo "Image size: $SIZE_MB MB"

.github/workflows/lxde-publish.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,12 @@ jobs:
5353
labels: ${{ steps.meta.outputs.labels }}
5454
cache-from: type=gha
5555
cache-to: type=gha,mode=max
56-
outputs: type=oci,dest=/tmp/image.tar
5756

5857
- name: Get image size
5958
id: image-size
6059
run: |
61-
# Load the image from the build step output
62-
docker load < /tmp/image.tar
63-
# Get the image ID from the loaded image
64-
IMAGE_ID=$(docker images --format "{{.ID}}" | head -n 1)
60+
IMAGE_ID="${{ steps.build-push.outputs.imageid }}"
6561
echo "Using image ID: $IMAGE_ID"
66-
# Get the image size
6762
SIZE=$(docker image inspect $IMAGE_ID --format='{{.Size}}')
6863
SIZE_MB=$(echo "scale=2; $SIZE/1024/1024" | bc)
6964
echo "size=$SIZE_MB MB" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)