update-bing-walpaper #1963
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: update-bing-walpaper | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '30 0 * * *' | |
repository_dispatch: | |
types: | |
- webhook | |
env: | |
STORAGE_TYPE: mongodb | |
# mongodb配置 | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
cache: 'pip' | |
python-version: 3.9.21 | |
- name: Install Requirements | |
working-directory: ./bing_wallpaper_api | |
run: | | |
pip install --upgrade pip 'pip<24.1' | |
pip install -r requirements.txt | |
pip install tencentcloud-sdk-python | |
pip install tencentcloud-sdk-python-cdn | |
- name: mongodb Update bing | |
if: ${{ env.STORAGE_TYPE == 'mongodb' }} | |
env: | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
working-directory: ./ | |
run: | | |
python bing_wallpaper_api/run.py | |
python bing_wallpaper_api/run_fix_last_day.py | |
- name: Commit json Files | |
run: | | |
sh commit.sh | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.MY_GIT_TOKEN }} | |
branch: master | |
- name: Refresh CDN #没有使用腾讯云cdn可删除该步骤 | |
run: | | |
python cdn.py ${{ secrets.TENCENT_SECRETID }} ${{ secrets.TENCENT_SECRETKEY }} ${{ secrets.CDN_URL }} |