diff --git a/actions/setup-flutter/action.yml b/actions/setup-flutter/action.yml index 4c8c6dc..030ce9f 100644 --- a/actions/setup-flutter/action.yml +++ b/actions/setup-flutter/action.yml @@ -33,60 +33,47 @@ runs: if: ${{ inputs.aop-registry }} shell: bash run: | - set -e + set -eu + echo "Setting up AOP registry for Flutter packages..." + flutter --version + cd ${{ env.FLUTTER_ROOT }} + git status + git restore . + git clean -fd + git status - patch_url="https://raw.githubusercontent.com/TDesignOteam/tdesign-flutter-aop-registry/refs/heads/main/patch_flutter/" + patch_prefix="https://raw.githubusercontent.com/TDesignOteam/tdesign-flutter-aop-registry/refs/heads/main/patch_flutter/" flutter_version=$(flutter --version | head -n 1 | awk '{print $2}') major_version=$(echo $flutter_version | cut -d. -f1) minor_version=$(echo $flutter_version | cut -d. -f2) # 确定适用的补丁文件 # 2.2~3.10.patch, 3.13~3.16.patch, 3.19~3.22.patch, 3.24~3.32.patch, 3.35~infinity.patch - patch_file="" + patch_name="" if [ "$major_version" -gt 3 ]; then - patch_file="3.35~infinity.patch" + patch_name="3.35~infinity.patch" elif [ "$major_version" -eq 3 ]; then if [ "$minor_version" -ge 35 ]; then - patch_file="3.35~infinity.patch" + patch_name="3.35~infinity.patch" elif [ "$minor_version" -ge 24 ] && [ "$minor_version" -le 32 ]; then - patch_file="3.24~3.32.patch" + patch_name="3.24~3.32.patch" elif [ "$minor_version" -ge 19 ] && [ "$minor_version" -le 22 ]; then - patch_file="3.19~3.22.patch" + patch_name="3.19~3.22.patch" elif [ "$minor_version" -ge 13 ] && [ "$minor_version" -le 16 ]; then - patch_file="3.13~3.16.patch" + patch_name="3.13~3.16.patch" elif [ "$minor_version" -ge 0 ] && [ "$minor_version" -le 10 ]; then - patch_file="2.2~3.10.patch" + patch_name="2.2~3.10.patch" fi elif [ "$major_version" -eq 2 ]; then if [ "$minor_version" -ge 2 ]; then - patch_file="2.2~3.10.patch" + patch_name="2.2~3.10.patch" fi fi - - if [ -z "$patch_file" ]; then - echo "No matching patch file found for Flutter version: $flutter_version" - exit 0 - fi - - echo "Flutter version: $flutter_version" - echo "Selected patch: $patch_file" - - # 进入 Flutter SDK 目录 - cd "${{ env.FLUTTER_ROOT }}" - - # 下载补丁 - echo "Downloading patch: $patch_url$patch_file" - patch_content=$(curl -fsSL "$patch_url$patch_file") - - # 检查补丁是否已应用 - if echo "$patch_content" | git apply --reverse --check 2>/dev/null; then - echo "Patch already applied, cleaning up old patch..." - echo "$patch_content" | git apply --reverse --verbose - echo "Old patch removed" - fi - - # 应用新补丁 - echo "Applying patch..." - echo "$patch_content" | git apply --verbose - - echo "✓ Patch applied successfully" + echo "patch_name: $patch_name" + patch_url="$patch_prefix$patch_name" + echo "patch_url: $patch_url" + wget $patch_url + git status + git apply $patch_name + git status + echo "AOP registry setup completed."