更新 .gitea/workflows/sync_raw_file.yml
Some checks failed
SyncRawFile / sync_files (push) Failing after 5s
Some checks failed
SyncRawFile / sync_files (push) Failing after 5s
This commit is contained in:
@@ -13,24 +13,40 @@ jobs:
|
|||||||
- name: Clone Gitea repository
|
- name: Clone Gitea repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Download raw files from GitHub
|
- name: Define file types and download
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ./surge/
|
# 定义文件目录和平台类型列表
|
||||||
curl -o ./surge/Lan.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Lan/Lan.list
|
directories=("Lan" "Apple" "Steam" "SteamCN" "Xbox" "OpenAI" "Gemini" "Claude" "China" "Proxy")
|
||||||
curl -o ./surge/Apple_All.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Apple/Apple_All.list
|
platform_types=("Surge" "Clash" "Loon" "QuantumultX" "Shadowrocket" )
|
||||||
curl -o ./surge/Steam.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list
|
|
||||||
curl -o ./surge/SteamCN.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/SteamCN/SteamCN.list
|
# 平台类型和文件扩展名的映射(Surge -> list, Clash -> txt)
|
||||||
curl -o ./surge/Xbox.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Xbox/Xbox.list
|
declare -A type_mapping
|
||||||
curl -o ./surge/OpenAI.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/OpenAI/OpenAI.list
|
type_mapping=(["Surge"]="list" ["Clash"]="list" ["Loon"]="list" ["QuantumultX"]="list" ["Shadowrocket"]="list")
|
||||||
curl -o ./surge/Gemini.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Gemini/Gemini.list
|
|
||||||
curl -o ./surge/Claude.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Claude/Claude.list
|
# 循环下载文件并根据平台类型和目录动态创建保存路径
|
||||||
curl -o ./surge/China_All.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/China/China_All.list
|
for i in ${!directories[@]}; do
|
||||||
curl -o ./surge/Proxy_All.list https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Proxy/Proxy_All.list
|
directory=${directories[$i]}
|
||||||
|
platform_type=${platform_types[$i]} # 使用平台类型变量
|
||||||
|
filetype=${type_mapping[$platform_type]} # 获取文件类型(list 或 txt)
|
||||||
|
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
|
||||||
|
|
||||||
- name: Commit and push changes to Gitea
|
- name: Commit and push changes to Gitea
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "yuanzhen869"
|
git config --global user.name "yuanzhen869"
|
||||||
git config --global user.email "yuanzhen869@gmail.com"
|
git config --global user.email "yuanzhen869@gmail.com"
|
||||||
git add surge/
|
git add . # 添加所有更改的文件
|
||||||
git commit -m "Sync files from GitHub raw" || echo "No changes to commit"
|
git commit -m "Sync files from GitHub raw" || echo "No changes to commit"
|
||||||
git push origin main
|
git push origin main
|
||||||
Reference in New Issue
Block a user