Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/compress-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Compress images on demand (workflow_dispatch), and at 12am every Sunday (schedule).
# Open a Pull Request if any images can be compressed.
Comment on lines +1 to +2

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc Sep 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines feel kind of useless to me

name: Compress Images
on:
workflow_dispatch:
push:
branches: [development]
paths:
- '_icons/**'
- 'src/renderer/assets/img/**'

permissions: {}

jobs:
compress:
name: Compress
runs-on: ubuntu-latest

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc Sep 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to use latest if not then best to change

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-slim


permissions:
contents: write
pull-requests: write

steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0

- name: Install Oxipng
run: cargo install oxipng
shell: bash

- name: Use Node.js 24.x
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.x
package-manager-cache: false

- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10
cache: false

- name: Compress SVG Images
run: |
pnpm dlx svgo -f ./_icons -o ./_icons
pnpm dlx svgo -f ./src/renderer/assets/img -o ./src/renderer/assets/img
shell: bash
- name: Compress PNG Images
run: oxipng -o max --strip safe --recursive ./_icons ./src/renderer/assets/img
shell: bash
Comment on lines +48 to +55

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc Sep 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Targeted dirs directly, remove recursive option as there isnt anything below those dirs. Let me know if you would prefer to include recursive anyway

Suggested change
- name: Compress SVG Images
run: pnpm dlx svgo -r -f . -o .
shell: bash
- name: Compress PNG Images
run: oxipng -o max --strip safe --recursive ./_icons ./src
shell: bash
- name: Compress SVG Images
run: |
pnpm dlx svgo -f ./_icons -o ./_icons
pnpm dlx svgo -f ./src/renderer/assets/img -o ./src/renderer/assets/img
shell: bash
- name: Compress PNG Images
run: oxipng -o max --strip safe ./_icons ./src/renderer/assets/img
shell: bash

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You keep missing --recursive on oxipng line (._.)

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc Sep 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove recursive option as there isnt anything below those dirs. Let me know if you would prefer to include recursive anyway

Just to be clear, would you like to keep recursive option for both svgo and oxipng?


- name: Generate File Diff Content
id: file_diff
uses: PikachuEXE/file-size-diff@c623d1e49f0b19ecb006caf05522f9756561052b
with:
target_branch: ${{ github.event.repository.default_branch }}
dir_glob: "**/*.png,**/*.svg"

- name: Create New Pull Request If Needed
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
title: Compressed Images Nightly
branch-suffix: timestamp
commit-message: Compress Images
body: |
Images automagically compressed by tools in `.github/workflows/compress-images.yml`

${{ steps.file_diff.outputs.file_size_diff_content_markdown }}
Binary file modified _icons/iconColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/renderer/assets/img/defaultBanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/renderer/assets/img/yt_logo_mono_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.