Skip to content

Commit

Permalink
Update openscad_build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
masuidrive authored Sep 8, 2023
1 parent be04a87 commit e9f3cca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/openscad_build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Generate STL and WebP Thumbnails using OpenSCAD
name: Generate STL and Thumbnails using OpenSCAD

on:
push:
Expand Down Expand Up @@ -38,16 +38,15 @@ jobs:
done
'
- name: Convert PNG thumbnails to WebP
run: |
for png in $(find . -name "*.png"); do
cwebp $png -o ${png%.png}.webp
done
- name: Clean up directory (Only keep STL and WebP files)
- name: Clean up directory (Only keep STL, WebP, and txt files)
run: |
find . ! -path "./.git/*" ! -name ".git" -type f ! \( -name "*.stl" -o -name "*.webp" \) -delete
find . ! -path "./.git/*" ! -name ".git" -type f ! \( -name "*.stl" -o -name "*.webp" -o -name "*.txt" \) -delete
- name: Generate index.html
run: |
Expand All @@ -57,6 +56,10 @@ jobs:
echo "<h2 class='text-2xl font-bold'>$dirName</h2><div class='grid grid-cols-4 gap-4'>" >> index.html
for webp in $(find $dir -name "*.webp"); do
baseName=$(basename -s .webp $webp)
txtPath="${webp%.webp}.txt"
if [[ -f $txtPath ]]; then
echo "<p class='col-span-4'>$(cat $txtPath | sed 's/$/<br \/>/')</p>" >> index.html
fi
echo "<img class='w-24 h-24' src='$webp' title='$baseName'>" >> index.html
done
echo "</div>" >> index.html
Expand Down

0 comments on commit e9f3cca

Please sign in to comment.