diff --git a/.gitea/workflows/build-images.yml b/.gitea/workflows/build-images.yml index f0450d0..4eab7ac 100644 --- a/.gitea/workflows/build-images.yml +++ b/.gitea/workflows/build-images.yml @@ -32,23 +32,35 @@ jobs: run: | echo "Event: ${{ gitea.event_name }}" + # Debug: show images directory + echo "Content of images/:" + ls -la images/ || echo "images/ not found" + if [ "${{ gitea.event_name }}" = "workflow_dispatch" ]; then echo "Manual trigger - building all images" - # List all directories with Dockerfile - IMAGES=$(find images -mindepth 1 -maxdepth 1 -type d -exec test -f {}/Dockerfile \; -print | xargs -n1 basename | tr '\n' ',' | sed 's/,$//') + # Simple loop to find images with Dockerfile + IMAGES="" + for dir in images/*/; do + if [ -f "${dir}Dockerfile" ]; then + name=$(basename "$dir") + echo "Found image: $name" + IMAGES="${IMAGES}${name}," + fi + done + IMAGES=${IMAGES%,} # Remove trailing comma else echo "Push event - detecting changes" IMAGES=$(git diff --name-only HEAD~1 HEAD -- images/ 2>/dev/null | cut -d'/' -f2 | sort -u | grep -v '^$' | tr '\n' ',' | sed 's/,$//') fi - echo "Detected images: $IMAGES" + echo "Detected images: >$IMAGES<" if [ -z "$IMAGES" ]; then echo "has_changes=false" >> $GITHUB_OUTPUT echo "image_list=[]" >> $GITHUB_OUTPUT else - # Convert to JSON array - JSON=$(echo "$IMAGES" | tr ',' '\n' | sed 's/.*/"&"/' | tr '\n' ',' | sed 's/,$//' | sed 's/^/[/' | sed 's/$/]/') + # Convert to JSON array - simple approach + JSON="[$(echo "$IMAGES" | sed 's/,/","/g' | sed 's/^/"/' | sed 's/$/"/' )]" echo "JSON: $JSON" echo "has_changes=true" >> $GITHUB_OUTPUT echo "image_list=$JSON" >> $GITHUB_OUTPUT