getSSR #219
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: getSSR | |
# 触发条件 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' | |
env: # 设置环境变量 | |
TZ: Asia/Shanghai | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 迁出代码 | |
uses: actions/checkout@v2 | |
- name: 安装Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: 加载缓存 | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/run_in_Actions/requirements2.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: 设置时区 | |
run: sudo timedatectl set-timezone 'Asia/Shanghai' | |
- name: 安装依赖 | |
run: | | |
pip install -r ./utils/requirements2.txt | |
- name: 执行任务 | |
env: | |
key: ${{secrets.key}} | |
host: ${{secrets.host}} | |
host_1: ${{secrets.host_1}} | |
host_2: ${{secrets.host_2}} | |
bot_token: ${{secrets.bot_token}} | |
chat_id: ${{secrets.chat_id}} | |
run: | | |
python ./utils/ssr.py | |
- name: Commit | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add ./links | |
git commit -m "ssr节点更新时间 $(date '+%Y-%m-%d %H:%M:%S')" | |
git config pull.rebase false | |
git pull origin master | |
git push origin master | |