Skip to content

Commit bb7314c

Browse files
committed
next try
1 parent 05756bb commit bb7314c

1 file changed

Lines changed: 16 additions & 24 deletions

File tree

.github/workflows/automatic_image_genration.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,41 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v4
3232
with:
33-
fetch-depth: 2 # Needed for git diff HEAD~1
33+
fetch-depth: 2
3434

3535
- name: Create output directory
3636
run: |
3737
mkdir -p ${{ env.OUTPUT_DIR }}
3838
echo "📁 Output directory: ${{ env.OUTPUT_DIR }}"
39-
echo "🔄 Regenerate all: ${{ github.event.inputs.regenerate_all || 'false' }}"
40-
41-
- name: Debug - Check repository structure
42-
run: |
43-
echo "=== Repository structure ==="
44-
find . -name "*.puml" -o -name "*.plantuml" -o -name "*.drawio" -o -name "*.dio" | head -20
45-
echo "=== src/plantuml contents ==="
46-
ls -la src/plantuml/ 2>/dev/null || echo "src/plantuml directory not found"
47-
echo "=== src/drawio contents ==="
48-
ls -la src/drawio/ 2>/dev/null || echo "src/drawio directory not found"
39+
echo "🔄 Regenerate all: '${{ github.event.inputs.regenerate_all }}'"
40+
echo "🔄 Event name: '${{ github.event_name }}'"
4941
5042
- name: Set up JDK 11
5143
uses: actions/setup-java@v4
5244
with:
5345
distribution: 'temurin'
5446
java-version: '11'
5547

48+
- name: Install Graphviz (for PlantUML)
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install -y graphviz
52+
5653
- name: Download and setup PlantUML
5754
run: |
5855
wget https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar -O /tmp/plantuml.jar
5956
echo "PlantUML downloaded successfully"
6057
java -jar /tmp/plantuml.jar -version
6158
62-
- name: Generate PlantUML images (incremental)
59+
- name: Generate PlantUML images (smart mode)
6360
continue-on-error: true
6461
run: |
6562
echo "=== Generating PlantUML images ==="
6663
6764
output_abs=$(pwd)/${{ env.OUTPUT_DIR }}
6865
69-
# Check if we should regenerate all or just changed files
70-
if [ "${{ github.event.inputs.regenerate_all }}" = "true" ]; then
66+
# Determine if we should process all files or just changed ones
67+
if [ "${{ github.event.inputs.regenerate_all }}" = "true" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
7168
echo "🔄 FULL REGENERATION MODE - Processing all files"
7269
puml_files=$(find $(pwd)/src/plantuml -name "*.puml" -o -name "*.plantuml" 2>/dev/null)
7370
@@ -104,25 +101,20 @@ jobs:
104101
echo "Processing: $file"
105102
base=$(basename "$file" | sed 's/\.[^.]*$//')
106103
107-
# Test PlantUML syntax first
108-
echo "Testing syntax for: $file"
109-
java -jar /tmp/plantuml.jar -syntax "$file" || echo "Syntax check failed"
110-
111104
# Generate PNG
112105
echo "Generating PNG for: $file"
113-
java -jar /tmp/plantuml.jar -v -tpng "$file" -o "$output_abs" 2>&1 | tee /tmp/plantuml.log
106+
java -jar /tmp/plantuml.jar -tpng "$file" -o "$output_abs" 2>&1
114107
115108
if [ -f "$output_abs/${base}.png" ]; then
116109
mv "$output_abs/${base}.png" "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.png"
117110
echo "✅ Generated PNG: ${{ env.PLANTUML_PREFIX }}_${base}.png"
118111
else
119112
echo "❌ PNG not created for $file"
120-
cat /tmp/plantuml.log || true
121113
fi
122114
123115
# Generate SVG
124116
echo "Generating SVG for: $file"
125-
java -jar /tmp/plantuml.jar -v -tsvg "$file" -o "$output_abs" 2>&1
117+
java -jar /tmp/plantuml.jar -tsvg "$file" -o "$output_abs" 2>&1
126118
127119
if [ -f "$output_abs/${base}.svg" ]; then
128120
mv "$output_abs/${base}.svg" "$output_abs/${{ env.PLANTUML_PREFIX }}_${base}.svg"
@@ -141,13 +133,13 @@ jobs:
141133
echo "--- Next file ---"
142134
done
143135
144-
- name: Generate Draw.io images (incremental)
136+
- name: Generate Draw.io images (smart mode)
145137
continue-on-error: true
146138
run: |
147139
echo "=== Generating drawio images ==="
148140
149-
# Check if we should regenerate all or just changed files
150-
if [ "${{ github.event.inputs.regenerate_all }}" = "true" ]; then
141+
# Determine if we should process all files or just changed ones
142+
if [ "${{ github.event.inputs.regenerate_all }}" = "true" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
151143
echo "🔄 FULL REGENERATION MODE - Processing all files"
152144
drawio_files=$(find src/drawio -name "*.drawio" -o -name "*.dio" 2>/dev/null)
153145

0 commit comments

Comments
 (0)