Files
bypass/.gitea/workflows/sync_raw_file.yml
yuanzhen869 7dc2e307b2
All checks were successful
SyncRawFile / sync_files (push) Successful in 27s
更新 .gitea/workflows/sync_raw_file.yml
2024-12-19 01:07:32 +00:00

52 lines
1.9 KiB
YAML

name: SyncRawFile
on:
push:
paths:
- .gitea/workflows/sync_raw_file.yml # 仅在该文件被修改时触发
schedule:
- cron: "0 * * * *" # 每小时执行一次
jobs:
sync_files:
runs-on: ubuntu-latest
steps:
- name: Clone Gitea repository
uses: actions/checkout@v2
- name: Define file types and download
run: |
# 定义文件目录和平台类型列表
directories=("Lan" "Apple" "Steam" "SteamCN" "Xbox" "OpenAI" "Gemini" "Claude" "China" "Proxy")
platform_types=("Surge" "Clash" "Loon" "QuantumultX" "Shadowrocket")
# 统一将所有文件扩展名设置为 list
filetype="list"
# 循环遍历每个平台
for platform_type in "${platform_types[@]}"; do
# 循环遍历每个目录
for directory in "${directories[@]}"; do
# 构建文件 URL
url="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/${platform_type}/${directory}/${directory}.${filetype}"
# 动态生成保存目录路径,基于平台类型和文件目录
save_dir="./${platform_type}/${directory}"
# 创建目录(如果不存在的话)
mkdir -p "$save_dir"
# 输出下载信息
echo "Downloading $url to $save_dir/${directory}.${filetype}"
# 使用 curl 下载文件并保存到动态路径
curl -o "$save_dir/${directory}.${filetype}" "$url"
done
done
- name: Commit and push changes to Gitea
run: |
git config --global user.name "yuanzhen869"
git config --global user.email "yuanzhen869@gmail.com"
git add . # 添加所有更改的文件
git commit -m "Sync files from GitHub raw" || echo "No changes to commit"
git push origin main