mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 23:50:31 +00:00
49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
name: logo timely update
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
name: Check out code
|
|
|
|
- name: update logo
|
|
run: |
|
|
# 获取contentful中所有url
|
|
entry=$(curl --include \
|
|
--request GET \
|
|
--header 'Authorization: Bearer ${{secrets.CONTENTFUL_TOKEN}}' \
|
|
https://api.contentful.com/spaces/ffrhttfighww/environments/master/entries?content_type=media\&select=fields.slug |tail -n 1)
|
|
echo $entry
|
|
applist=$(echo $entry | sed 's/en-US/en/g' | jq -r '.items[] | .fields.slug.en')
|
|
echo $applist
|
|
|
|
for app in ${applist};do
|
|
if [ "$app" = null ];then
|
|
continue
|
|
fi
|
|
item=$(curl --include \
|
|
--request GET \
|
|
--header 'Authorization: Bearer ${{secrets.CONTENTFUL_TOKEN}}' \
|
|
https://api.contentful.com/spaces/ffrhttfighww/environments/master/entries?content_type=media\&fields.slug=${app}\&select=fields.imageurl\&locale=en-US | tail -n 1)
|
|
echo $item
|
|
url=$(echo $item | sed 's/en-US/en/' | jq -r '.items[0].fields.imageurl.en')
|
|
echo $url
|
|
file=$(echo appmanage/static/images/${url##*/})
|
|
echo $file
|
|
if [[ -f ${file} ]];then
|
|
echo "存在此文件,跳过"
|
|
continue
|
|
fi
|
|
echo "执行wget"
|
|
wget --timeout=3 -q -P appmanage/static/images "$url"
|
|
done
|
|
|
|
- name: push logo
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: update logo
|