tinify images #24
Workflow file for this run
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 images with TinyPNG" | |
on: | |
push: | |
paths: | |
- "**.jpg" | |
- "**.jpeg" | |
- "**.png" | |
- "**.webp" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- id: changed | |
uses: jitterbit/get-changed-files@v1 | |
with: | |
format: "csv" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: pip install tinify tqdm python-dotenv | |
- name: Tinify Images | |
run: | | |
if [ -z "${{ steps.changed.outputs.added_modified }}" ]; then | |
echo "No files changed, skipping" | |
exit 0 | |
fi | |
python .github/scripts/tinify_images.py \ | |
-d images \ | |
-ff ${{ steps.changed.outputs.added_modified }} \ | |
-k ${{ secrets.TINIFY_API_KEY }} \ | |
|| exit 1 | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: "Optimize images with TinyPNG" |