Skip to content

bing_image

bing_image #1186

Workflow file for this run

name: Bing Image
on:
repository_dispatch:
types:
- bing_image
# schedule:
# # Times are in UTC
# - cron: '0 9 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repository
uses: actions/checkout@v3
- name: install ghostscript
run: |
sudo apt-get update
sudo apt-get install ghostscript
- name: download image
run: |
baseURL='https://www.bing.com'
jsonURL="${baseURL}/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-CA"
jsonData=$(curl -s "${jsonURL}")
imageURL="${baseURL}"$( echo "${jsonData}" | jq -r '.images[0].url' )
echo "${imageURL}"
imageDesc=$(echo "${jsonData}" | jq -r '.images[0].copyright')
curl -Lo homepage/images/today_clean.jpg "${imageURL}"
convert -font DejaVu-Sans -pointsize 18 -background '#00000080' -fill white label:"${imageDesc}" miff:- | \
composite -gravity south -geometry +0+60 - homepage/images/today_clean.jpg homepage/images/today.jpg
convert -quality 50 homepage/images/today.jpg homepage/images/today.avif
convert -quality 50 homepage/images/today.jpg homepage/images/today.webp
- name: update readme
run: |
sed -i "s|\(image: \).*$|\1$(date -u)|" homepage/README.md
- name: commit and push
run: |
git config --local user.email "alim@forwardcomputers.com"
git config --local user.name "Ali Mustakim"
git add .
git diff-index --quiet HEAD || git commit -a -m "github actions update"
git push origin