Skip to content

Commit b1fd017

Browse files
committed
Automated workflow dispatch for oxipng
1 parent 87de368 commit b1fd017

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright (c) godot-rust; Bromeon and contributors.
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
name: "Push oxipng image"
7+
8+
on:
9+
# workflow_dispatch:
10+
# inputs:
11+
# repository:
12+
# description: "owner/repo"
13+
# required: true
14+
# branch:
15+
# description: "branch used for PR"
16+
# required: true
17+
repository_dispatch:
18+
types: [oxipng-event]
19+
20+
env:
21+
OXIPNG_VERSION: "9.1.1"
22+
23+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
24+
permissions:
25+
contents: write # git push for oxipng
26+
pages: write
27+
id-token: write
28+
29+
jobs:
30+
oxipng-write:
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: write # git push
34+
steps:
35+
36+
- uses: actions/checkout@v4
37+
with:
38+
repository: ${{ github.event.client_payload.repository }}
39+
ref: ${{ github.event.client_payload.branch }}
40+
token: ${{ secrets.PR_PUSH_TOKEN }}
41+
42+
- name: "Run oxipng to reduce PNG sizes"
43+
run: |
44+
wget https://github.com/shssoichiro/oxipng/releases/download/v${OXIPNG_VERSION}/oxipng-${OXIPNG_VERSION}-x86_64-unknown-linux-musl.tar.gz \
45+
-O /tmp/oxipng.tar.gz
46+
47+
tar -xvzf /tmp/oxipng.tar.gz -C /tmp
48+
mv /tmp/oxipng-${OXIPNG_VERSION}-x86_64-unknown-linux-musl/oxipng ./oxipng
49+
chmod +x ./oxipng
50+
51+
./oxipng --version
52+
./oxipng --strip safe --alpha -r src
53+
54+
# See https://github.com/EndBug/add-and-commit#add--commit.
55+
- name: "Commit changes"
56+
uses: EndBug/add-and-commit@v9
57+
with:
58+
author_name: 'Godot-Rust Automation'
59+
author_email: '[email protected]'
60+
message: 'Auto-reduce PNG sizes'
61+
add: 'src/**/*.png'

0 commit comments

Comments
 (0)