Skip to content

Commit ba83a8a

Browse files
committed
test docker hub query without building image
1 parent 0bd9ae0 commit ba83a8a

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/docker-publish.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,22 @@ jobs:
4141
name: Copy composer installation file
4242
run: |
4343
cp ./install-composer.sh ./${{ matrix.directory }}
44-
-
45-
name: Build and push
46-
uses: docker/build-push-action@v6
47-
with:
48-
context: .
49-
file: ${{ matrix.directory }}/Dockerfile
50-
push: false
51-
tags: ${{ matrix.tagging }}
44+
45+
- name: Query existing Docker image tags
46+
run: |
47+
TAG_EXISTS=$(curl -s "https://hub.docker.com/v2/repositories/${{ matrix.image }}/tags/?page_size=100" | jq -r '.results[].name' | grep -w "${{ matrix.tagging }}" || true)
48+
if [ -n "$TAG_EXISTS" ]; then
49+
echo "Tag ${{ matrix.tagging}} already exists!"
50+
else
51+
echo "Tag ${{ matrix.tagging}} does not exist, proceed with building the image."
52+
fi
53+
54+
#-
55+
# name: Build and push
56+
# uses: docker/build-push-action@v6
57+
# with:
58+
# context: .
59+
# file: ${{ matrix.directory }}/Dockerfile
60+
# push: false
61+
# load: true
62+
# tags: ${{ matrix.tagging }}

0 commit comments

Comments
 (0)