@@ -311,6 +311,12 @@ jobs:
311311 username : ${{ secrets.DOCKER_USERNAME }}
312312 password : ${{ secrets.DOCKER_PASSWORD }}
313313
314+ - name : Install dependencies
315+ run : |
316+ # Install yq for YAML parsing
317+ wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
318+ chmod +x /usr/local/bin/yq
319+
314320 - name : Find extensions
315321 id : find_extensions
316322 run : |
@@ -327,15 +333,22 @@ jobs:
327333
328334 echo "Processing extension: $ext_name from $ext_file"
329335
330- # Parse the YAML file to get outname and base image details
331- outname=$(grep -A2 outname "$ext_file" | grep -v outname | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "' ")
332- base_image=$(grep -A2 image "$ext_file" | grep -v image | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "' ")
336+ # Parse YAML directly using yq
337+ outname=$(yq '.container. outname' "$ext_file")
338+ base_image=$(yq '.container.base. image' "$ext_file")
333339
334- # Handle tags - could be a single tag or a list
335- tags=$(grep -A5 tag "$ext_file" | grep -v tag | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "'" | tr -d "{" | tr -d "}" | tr "," " ")
340+ # Handle tags which could be a string, list, or map
341+ tags=$(yq -o=json '.container.base. tag' "$ext_file")
336342
337- if [ -z "$tags" ]; then
343+ # Process tags based on their type
344+ if [[ "$tags" == "null" ]]; then
338345 tags="$branch"
346+ elif [[ "$tags" == "{\"*\"}" ]]; then
347+ # Handle object format like {"3.21", "devel"}
348+ tags=$(echo "$tags" | jq -r 'keys | join(" ")')
349+ elif [[ "$tags" == "[*]" ]]; then
350+ # Handle array format
351+ tags=$(echo "$tags" | jq -r 'join(" ")')
339352 fi
340353
341354 echo "Building extension $ext_name: $outname from $base_image with tags: $tags"
0 commit comments