Skip to content

Daily

Daily #21067

Workflow file for this run

name: Daily
on:
push:
paths:
- .github/workflows/daily.yml # Only run a new workflow every time this file (flat.yaml) file changes
workflow_dispatch: # Required even though this is currently empty
schedule:
- cron: "0 * * * *" # Run this workflow every 5 minutes
jobs:
daily:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup ImageMagick
uses: mfinelli/setup-imagemagick@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
- name: Remove old daily
run: |
rm -rf content/daily/**/*.webp
rm -rf content/daily/**/*.jpg
- name: Fetch daily album
run: |
ruby bin/download-lr.rb
- name: Convert to webp
run: |
for file in $(find content/daily \( -iname "*.jpg" -or -iname "*.jpeg" -or -iname "*.png" -or -iname "*.tif" -or -iname "*.bmp" \)) ; do
magick convert ${file} -quality 80 -resize 1500x1500 -density 72x72 -format webp ${file%.*}.webp;
done
- name: Remove jpgs
run: |
rm -rf content/daily/**/*.jpg
- name: Commit files
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git add -A content/daily/
git commit -m "Sync the daily album" || echo "nothing to do and it is fine"
git pull origin ${{ github.ref }}
echo "::set-output name=push::true"
shell: bash
- name: Push changes
if: steps.commit.outputs.push == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}