1919env :
2020 REL_PLANTUML_INPUT_DIR : src/plantuml
2121 REL_DRAWIO_INPUT_DIR : src/drawio
22- REL_OUTPUT_DIR : images
2322 OUTPUT_DIR : $(pwd)/images
2423 PLANTUML_PREFIX : uml_
2524 DRAWIO_PREFIX : diagram_
@@ -227,7 +226,6 @@ jobs:
227226 echo "=== 🎯 Generating Draw.io images ==="
228227
229228 rel_input_dir=${{ env.REL_DRAWIO_INPUT_DIR }}
230- rel_output_dir=${{ env.REL_OUTPUT_DIR }}
231229 output_dir=${{ env.OUTPUT_DIR }}
232230 echo "📁 Output directory: $output_dir"
233231
@@ -285,11 +283,12 @@ jobs:
285283 echo ""
286284 echo "🖼️ Generating PNG for: $file"
287285
286+ # docker output directory: src/drawio
288287 docker run --rm \
289288 -v "$(pwd):/data" \
290289 rlespinasse/drawio-export:4.4.0 \
291290 --format png \
292- --output "../../${rel_output_dir}/${prefix_base}.png " \
291+ --output "../" \
293292 "$rel_input_file_path"
294293
295294 png_exit_code=$?
@@ -299,13 +298,27 @@ jobs:
299298 else
300299 echo "✅ PNG generation command completed"
301300 fi
302-
303- # Check for PNG file in output directory
304- if [ -f "${output_dir}/${prefix_base}.png" ]; then
305- echo "✅ Final PNG: ${output_dir}/${prefix_base}.png"
306- else
307- echo "❌ Expected PNG not found: ${output_dir}/${prefix_base}.png"
308- fi
301+
302+ # find all docker drawio generated *.png images, rename and move them to the /image folder
303+ png_files=($(find "$SOURCE_DIR" -name "*.png" -type f | sort))
304+
305+ for i in "${!png_files[@]}"; do
306+ source_file="${png_files[$i]}"
307+
308+ if [ ${#png_files[@]} -eq 1 ]; then
309+ target_file="${output_dir}/${prefix_base}.png"
310+ else
311+ target_file="${output_dir}/${prefix_base}_$((i + 1)).png"
312+ fi
313+
314+ if mv "$source_file" "$target_file"; then
315+ echo "✅ Moved : $(basename "$source_file") → $(basename "$target_file")"
316+ else
317+ echo "❌ Failed to move : $source_file"
318+ exit 1
319+ fi
320+
321+ done
309322
310323 # Generate SVG
311324 echo ""
@@ -315,7 +328,7 @@ jobs:
315328 -v "$(pwd):/data" \
316329 rlespinasse/drawio-export:4.4.0 \
317330 --format svg \
318- --output "../../${rel_output_dir}/${prefix_base}.svg " \
331+ --output "../" \
319332 " $rel_input_file_path"
320333
321334 svg_exit_code=$?
@@ -326,12 +339,26 @@ jobs:
326339 echo "✅ SVG generation command completed"
327340 fi
328341
329- # Check for SVG files
330- if [ -f "${output_dir}/${prefix_base}.svg" ]; then
331- echo "✅ Final SVG: ${output_dir}/${prefix_base}.svg"
332- else
333- echo "❌ Expected SVG not found: ${output_dir}/${prefix_base}.svg"
334- fi
342+ # find all docker drawio generated *.svg images, rename and move them to the /image folder
343+ svg_files=($(find "$SOURCE_DIR" -name "*.svg" -type f | sort))
344+
345+ for i in "${!svg_files[@]}"; do
346+ source_file="${svg_files[$i]}"
347+
348+ if [ ${#svg_files[@]} -eq 1 ]; then
349+ target_file="${output_dir}/${prefix_base}.svg"
350+ else
351+ target_file="${output_dir}/${prefix_base}_$((i + 1)).svg"
352+ fi
353+
354+ if mv "$source_file" "$target_file"; then
355+ echo "✅ SVG File Moved : $(basename "$source_file") → $(basename "$target_file")"
356+ else
357+ echo "❌ Failed to move SVG File : $source_file"
358+ exit 1
359+ fi
360+
361+ done
335362
336363 echo "📁 Final output directory state:"
337364 ls -la "${output_dir}/" | sed 's/^/ | /'
0 commit comments