更新 .gitea/workflows/sync_raw_file.yml
All checks were successful
SyncRawFile / sync_files (push) Successful in 17s
All checks were successful
SyncRawFile / sync_files (push) Successful in 17s
This commit is contained in:
@@ -13,30 +13,28 @@ jobs:
|
||||
- name: Clone Gitea repository
|
||||
uses: actions/checkout@v3 # 使用最新版本的 checkout
|
||||
|
||||
- name: Debug current directory and contents
|
||||
run: |
|
||||
echo "Current working directory: $(pwd)"
|
||||
echo "Contents of ./rule directory before cleaning:"
|
||||
ls -al ./rule # 输出 ./rule 目录的内容,便于检查
|
||||
|
||||
- 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")
|
||||
|
||||
# 平台类型和文件扩展名的映射
|
||||
declare -A type_mapping
|
||||
type_mapping=(["Surge"]="list" ["Clash"]="yaml" ["Loon"]="list" ["QuantumultX"]="list" ["Shadowrocket"]="list")
|
||||
|
||||
# 平台类型和扩展名的映射
|
||||
declare -A platform_extensions
|
||||
platform_extensions=(
|
||||
["Surge"]="list"
|
||||
["Clash"]="yaml"
|
||||
["Loon"]="list"
|
||||
["QuantumultX"]="list"
|
||||
["Shadowrocket"]="list"
|
||||
)
|
||||
|
||||
# 循环遍历每个平台
|
||||
for platform_type in "${platform_types[@]}"; do
|
||||
for platform_type in "${!platform_extensions[@]}"; do
|
||||
# 为每个平台类型创建对应目录
|
||||
save_dir="./rule/${platform_type}"
|
||||
|
||||
# 检查并删除已存在的目录
|
||||
if [ -d "$save_dir" ]; then
|
||||
echo "Deleting existing directory: $save_dir"
|
||||
rm -rf "$save_dir" # 删除目录及其内容
|
||||
fi
|
||||
|
||||
@@ -44,7 +42,7 @@ jobs:
|
||||
mkdir -p "$save_dir"
|
||||
|
||||
# 获取当前平台类型的扩展名
|
||||
filetype=${type_mapping[$platform_type]}
|
||||
filetype=${platform_extensions[$platform_type]}
|
||||
|
||||
# 循环遍历每个目录,下载对应平台下的文件
|
||||
for directory in "${directories[@]}"; do
|
||||
@@ -52,16 +50,10 @@ jobs:
|
||||
url="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/${platform_type}/${directory}/${directory}.${filetype}"
|
||||
|
||||
# 使用 curl 下载文件并保存到动态路径
|
||||
echo "Downloading $url to $save_dir/${directory}.${filetype}"
|
||||
curl -o "$save_dir/${directory}.${filetype}" "$url"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Debug contents after download
|
||||
run: |
|
||||
echo "Contents of ./rule directory after download:"
|
||||
ls -al ./rule # 输出 ./rule 目录的内容,检查文件是否成功下载
|
||||
|
||||
- name: Commit and push changes to Gitea
|
||||
run: |
|
||||
# 设置 Git 配置信息
|
||||
|
||||
Reference in New Issue
Block a user