Skip to content

Commit e36995a

Browse files
authored
更新 duya.yml
1 parent 958958e commit e36995a

1 file changed

Lines changed: 7 additions & 25 deletions

File tree

.github/workflows/duya.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,38 @@
1-
# 针对 `duya.py` 文件的 GitHub Actions 工作流配置
2-
3-
以下是专门为您的 `duya.py` 文件优化的工作流配置,解决了之前的弃用问题并适配了您的实际文件名:
4-
5-
```yaml
61
name: Get Duya Subscription
72

83
on:
9-
workflow_dispatch: # 手动触发按钮
4+
workflow_dispatch: # 手动触发
105

116
jobs:
127
get-sub:
138
runs-on: ubuntu-latest
149
steps:
15-
# 1. 获取仓库代码
1610
- name: Checkout repository
1711
uses: actions/checkout@v4
1812

19-
# 2. 设置Python环境
2013
- name: Set up Python 3.10
2114
uses: actions/setup-python@v5
2215
with:
2316
python-version: '3.10'
2417

25-
# 3. 安装依赖
2618
- name: Install required packages
2719
run: pip install requests
2820

29-
# 4. 运行您的脚本
3021
- name: Run duya.py script
3122
id: run-script
3223
run: |
33-
# 运行脚本并将输出保存到变量
34-
output=$(python duya.py)
24+
# 运行脚本并捕获输出(若脚本报错,这一步会失败)
25+
output=$(python duya.py 2>&1) # 捕获标准错误(可选,用于调试)
3526
36-
# 设置输出变量供后续步骤使用
27+
# 设置输出变量(供后续步骤使用)
3728
echo "result=$output" >> $GITHUB_OUTPUT
3829
39-
# 直接将结果写入文件(双重备份)
30+
# 将结果写入文件(双重备份)
4031
echo "$output" > subscription.txt
4132
42-
# 5. 上传结果文件
4333
- name: Upload subscription file
4434
uses: actions/upload-artifact@v4
4535
with:
4636
name: duya-subscription
47-
path: |
48-
subscription.txt
49-
retention-days: 1 # 只保留1天
50-
51-
# 6. 上传脚本本身(可选)
52-
- name: Upload script file
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: script-file
56-
path: duya.py
37+
path: subscription.txt
38+
retention-days: 1 # 保留1天(避免占用存储空间)

0 commit comments

Comments
 (0)