Skip to content

Background Generator #1432

Background Generator

Background Generator #1432

Workflow file for this run

name: Background Generator
on:
push:
paths:
- "apps/background/*.py"
workflow_dispatch:
schedule:
- cron: '30 20 * * *'
- cron: '0 9 * * *'
issues:
types:
- "opened"
jobs:
generate_background:
name: Generate Background
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python Environment
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: x64
- name: Install Libraries
run: |
pip install -r apps/background/requirements.txt
mkdir cache
wget -O cache/smiley-sans.zip https://github.com/atelier-anchor/smiley-sans/releases/download/v1.1.1/smiley-sans-v1.1.1.zip
# wget -O cache/QingkeHuangyou.zip https://fonts.google.com/download?family=ZCOOL%20QingKe%20HuangYou
wget -O cache/ZCOOLQingKeHuangYou-Regular.ttf https://fonts.gstatic.com/s/zcoolqingkehuangyou/v15/2Eb5L_R5IXJEWhD3AOhSvFC554MOOahI4mRIi_28c8bHWA.ttf
wget -O cache/pexels_logo.png --header="User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11" "https://images.pexels.com/lib/api/pexels-white.png"
unzip cache/smiley-sans.zip -d cache
# unzip cache/QingkeHuangyou.zip -d cache
- name: Generate Background
env:
PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }}
AMAP_API_KEY: ${{ secrets.AMAP_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_TITLE: ${{ github.event.issue.title }}
TRIGGER: ${{ github.event_name }}
run: |
python apps/background/main.py
- name: Commit Changes
run: |
git config user.name woshishabii
git config user.email [email protected]
git fetch
git pull
git add .
git commit -m "Background Generator: `date "+%Y-%m-%d %H:%M:%S UTC%:z"`" || true
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}