Skip to content

Commit 092fab6

Browse files
Copilotdavidfowl
andcommitted
Improve Docker image discovery with sort by creation date and specific pattern matching
Co-authored-by: davidfowl <[email protected]>
1 parent 244838e commit 092fab6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/aspire-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
BRANCH_NAME=${{ github.ref_name }}
4040
SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's#[^a-zA-Z0-9._-]#-#g')
4141
42-
# Query docker images and find the latest chatapi and chatui images
43-
CHATAPI_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -i "chatapi" | grep -v "none" | head -n 1)
44-
CHATUI_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -i "chatui" | grep -v "none" | head -n 1)
42+
# Query docker images and find the latest chatapi and chatui images (most recently built)
43+
CHATAPI_IMAGE=$(docker images --format "{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}" | grep -E $'^\t[^/]*chatapi:' | sort -r | head -n 1 | awk '{print $NF}')
44+
CHATUI_IMAGE=$(docker images --format "{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}" | grep -E $'^\t[^/]*chatui:' | sort -r | head -n 1 | awk '{print $NF}')
4545
4646
# Tag and push chatapi if found
4747
if [ -n "$CHATAPI_IMAGE" ]; then

0 commit comments

Comments
 (0)