mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-01-12 03:07:26 +01:00
ci(github-actions): add PNG-only output
This commit is contained in:
parent
2db16cefea
commit
7cef998c6f
@ -20,13 +20,13 @@ failed_files = []
|
||||
converted_pngs = 0
|
||||
converted_webps = 0
|
||||
total_icons = 0
|
||||
png_only_icons = [] # List to store PNG-only icons
|
||||
|
||||
def file_size_readable(size_bytes):
|
||||
"""Convert bytes to a human-readable format."""
|
||||
for unit in ['B', 'KB', 'MB', 'GB']:
|
||||
if size_bytes < 1024:
|
||||
return f"{size_bytes:.2f} {unit}"
|
||||
#size_bytes /= 1024
|
||||
size_bytes /= 1024
|
||||
return f"{size_bytes:.2f} TB"
|
||||
|
||||
@ -154,6 +154,9 @@ if __name__ == "__main__":
|
||||
|
||||
valid_basenames.add(png_path.stem)
|
||||
|
||||
# Add the PNG-only icon to the list
|
||||
png_only_icons.append(png_path.stem)
|
||||
|
||||
# Set path for WEBP
|
||||
webp_path = WEBP_DIR / f"{png_path.stem}.webp"
|
||||
|
||||
@ -161,7 +164,6 @@ if __name__ == "__main__":
|
||||
convert_image_to_webp(png_path, webp_path)
|
||||
|
||||
# Clean up unused files in PNG and WEBP directories
|
||||
# Only remove files that don't have corresponding SVG or PNG files
|
||||
removed_pngs = clean_up_files(PNG_DIR, valid_basenames.union({p.stem for p in SVG_DIR.glob("*.svg")}))
|
||||
removed_webps = clean_up_files(WEBP_DIR, valid_basenames)
|
||||
|
||||
@ -176,4 +178,12 @@ if __name__ == "__main__":
|
||||
if failed_files:
|
||||
print("\nThe following files failed to convert:")
|
||||
for file in failed_files:
|
||||
print(file)
|
||||
print(file)
|
||||
|
||||
# Output PNG-only icons
|
||||
if png_only_icons:
|
||||
print("\nPNG-only icons (no SVG available):")
|
||||
for icon in png_only_icons:
|
||||
print(f"- {icon}")
|
||||
else:
|
||||
print("\nNo PNG-only icons found.")
|
Loading…
Reference in New Issue
Block a user