Skip to content

auto restart

auto restart #4

Workflow file for this run

name: auto restart
on:
workflow_dispatch:
schedule:
- cron: "0 */6 * * *" # 每6小时运行一次,可以根据需求调整时间
push:
branches:
- release
jobs:
auto_restart:
runs-on: ubuntu-latest
steps:
- name: Checkout 仓库代码
uses: actions/checkout@v2
- name: 设置 Python 环境
uses: actions/setup-python@v2
with:
python-version: '3.12.3' # 设置你希望使用的 Python 版本,建议使用稳定版本
- name: Create user_info.json from environment variable
run: echo "$USER_INFO" > user_info.json
env:
USER_INFO: ${{ secrets.USER_INFO}} # 从GitHub Secrets中获取环境变量
- name: Create env_config.json from environment variable
run: echo "$ENV_CONFIG" > env_config.json
env:
ENV_CONFIG: ${{ secrets.ENV_CONFIG}} # 从GitHub variables中获取环境变量
- name: 安装依赖
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: 运行登录脚本
env:
USER_INFO: ${{ secrets.USER_INFO }}
ENV_CONFIG: ${{ secrets.ENV_CONFIG }}
ENV_CMD: ${{ secrets.ENV_CMD }}
run: |
python login_auto_deploy.py