💄 Make small improvements #307
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ⚡ Optimize PNG files | |
on: | |
push: | |
branches: | |
- '[0-9].[0-9]+**' | |
- snapshot | |
paths: | |
- '**/*.png' | |
jobs: | |
build: | |
name: ⚡ Optimize PNG files | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🚚 Get latest code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 📦 Install oxipng | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: oxipng | |
version: latest | |
- name: 🧾 Get changed PNG files | |
id: changed-files | |
uses: tj-actions/changed-files@v35 | |
with: | |
since_last_remote_commit: "true" | |
files: "**/*.png" | |
- name: ⚡ Optimize PNG files | |
run: oxipng -sZ -o 3 -i 0 --ng ${{ steps.changed-files.outputs.all_changed_files }} | |
- name : 🧾 Get optimized PNG files | |
id: optimized-files | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "all_optimized_files<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(git status --porcelain | sed s/^...//)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: ⬆️ Commit and push changes | |
if: ${{ steps.optimized-files.outputs.all_optimized_files }} | |
uses: swinton/[email protected] | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ steps.optimized-files.outputs.all_optimized_files }} | |
commit-message: ':zap: Optimize PNG files' | |
ref: ${{ github.ref }} |