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: GIF to WebP Conversion | |
on: | |
push: | |
branches: | |
- main # or your default branch name | |
permissions: | |
contents: write | |
jobs: | |
convert-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y imagemagick | |
sudo apt-get install -y webp | |
curl -L https://github.com/ImageOptim/gifski/releases/download/1.11.0/gifski_1.11.0_amd64.deb -o gifski.deb | |
sudo dpkg -i gifski.deb | |
- name: Run conversion script | |
run: | | |
node gif-to-webp-converter.js | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add -A | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Convert GIF files to WebP" | |
git push | |
fi |