Get Duya Subscription #2
This file contains hidden or 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: Get Duya Subscription | |
| on: | |
| workflow_dispatch: # 手动触发 | |
| jobs: | |
| get-sub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install required packages | |
| run: pip install requests | |
| - name: Run duya.py script | |
| id: run-script | |
| run: | | |
| # 运行脚本并捕获输出(若脚本报错,这一步会失败) | |
| output=$(python duya.py 2>&1) # 捕获标准错误(可选,用于调试) | |
| # 设置输出变量(供后续步骤使用) | |
| echo "result=$output" >> $GITHUB_OUTPUT | |
| # 将结果写入文件(双重备份) | |
| echo "$output" > subscription.txt | |
| - name: Upload subscription file | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: duya-subscription | |
| path: subscription.txt | |
| retention-days: 1 # 保留1天(避免占用存储空间) |