-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add workflows to optimize PNG & SVG files #9719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
48f0347
eaafe18
eb94c99
14420b5
8adcd96
09cab3d
1c12f90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||||||||||||||||||||||||||||||||
| # Compress images on demand (workflow_dispatch), and at 12am every Sunday (schedule). | ||||||||||||||||||||||||||||||||||
| # Open a Pull Request if any images can be compressed. | ||||||||||||||||||||||||||||||||||
| name: Compress Images | ||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||||||||||||
| - cron: '0 0 * * 0' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| permissions: {} | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| compress: | ||||||||||||||||||||||||||||||||||
| # As this action runs on a schedule, only run it in the FreeTubeApp/FreeTube repository to avoid unnecessary GitHub Actions usage/billing in forks. | ||||||||||||||||||||||||||||||||||
| # Still allow the workflow to be manually triggered. | ||||||||||||||||||||||||||||||||||
| # If a fork does need this workflow, they can change this condition in their fork to include their repository. | ||||||||||||||||||||||||||||||||||
| if: github.repository == 'FreeTubeApp/FreeTube' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+16
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isnt needed anymore because there isnt a schedule
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| name: Compress | ||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 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 -r -f . -o . | ||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Compress PNG Images | ||||||||||||||||||||||||||||||||||
| run: oxipng -o max --strip safe --recursive ./_icons ./src | ||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+56
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: 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` | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Filediff on Images | ||
| on: | ||
| pull_request: | ||
| branches: [ development ] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| filediff: | ||
| name: filediff | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| pull-requests: write | ||
| repository-projects: read | ||
|
|
||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Create filediff comment | ||
| uses: PikachuEXE/filediff@2cfa654ec8e72e7a78c504f0e862ca83738bf3b7 # v0.0.4 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| target_branch: ${{ github.event.repository.default_branch }} | ||
| dir_glob: "**/*.png,**/*.svg" | ||
| file_details_open: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per PikachuEXE#87 (comment)