修改工作流 #4
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: Python CI | |
on: | |
# 每天0点1分触发(UTC时间) | |
schedule: | |
- cron: '1 0 * * *' | |
# 允许手动触发工作流 | |
workflow_dispatch: | |
# 提交代码到指定分支时触发 | |
push: | |
branches: | |
- main # 只在主分支提交时触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt # 假设你的项目有 requirements.txt | |
- name: Write config.json from environment variable | |
run: | | |
echo "生成 config.json 文件..." | |
echo "${{ secrets.CONFIG_JSON }}" > config.json | |
- name: Run Python script | |
run: python 69yun.py # 执行你的 Python 脚本 |