Update photography.html #30
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: Compress Images | |
on: | |
push: | |
jobs: | |
compress-images: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true # Allows GitHub Actions to push changes back | |
- name: Compress Images | |
uses: ClydeDz/[email protected] | |
with: | |
input-directory: assets/photos | |
output-directory: assets/compressed_photos | |
jpg-compression-quality: 40 | |
png-compression-quality: 0.4 | |
gif-compression-quality: 4 | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add assets/compressed_photos | |
# Check if there are any changes to commit | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "Compress images and save output" | |
git push | |
else | |
echo "No changes to commit." | |
fi |