From 7dde0cdf8ec7346a5ae34f27cc3d268a054097ea Mon Sep 17 00:00:00 2001 From: liyi Date: Sat, 17 May 2025 14:00:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0android=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.sh | 4 ++++ android/fastlane/Fastfile | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/android/build.sh b/android/build.sh index c6dd6d91..31d08255 100755 --- a/android/build.sh +++ b/android/build.sh @@ -20,6 +20,10 @@ elif [[ $ENV_BUILD_TAG =~ $regex ]]; then bundle exec fastlane release_apk flavor:sky --verbose || { echo "[FATAL] fastlane release_apk sky 失败"; exit 11; } bundle exec fastlane release_bundle flavor:xhj_bundle --verbose || { echo "[FATAL] fastlane release_bundle xhj_bundle 失败"; exit 12; } bundle exec fastlane release_bundle flavor:sky --verbose || { echo "[FATAL] fastlane release_bundle sky 失败"; exit 13; } + if [ ! -d build/app/outputs/flutter-apk/ ]; then + echo "❌ 产物目录 build/app/outputs/flutter-apk/ 未生成,构建失败!" + exit 99 + fi ls -l build/app/outputs/flutter-apk/ elif [[ "${ENV_BUILD_BRANCH}" == "develop" ]]; then echo "===build dev===${NEXT_VERSION}" diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index c8fe4f09..00e3b286 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -95,6 +95,9 @@ platform :android do new_file_path = File.join($path_apk_output_dir, "starlock-sky-preview-#{build_version}.apk") print_log "old_file_path: #{old_file_path}" print_log "new_file_path: #{new_file_path}" + unless File.exist?(old_file_path) + UI.user_error!("❌ 产物 #{old_file_path} 未生成,构建失败!") + end File.rename(old_file_path, new_file_path) logs = changelog_from_git_commits( pretty: '- %s (%cn)', @@ -136,6 +139,9 @@ platform :android do new_apk_file_path = File.join($path_apk_output_dir, "starlock-sky-release-"+$current_tag+".apk") print_log "old_apk_file_path: #{old_apk_file_path}" print_log "new_apk_file_path: #{new_apk_file_path}" + unless File.exist?(old_apk_file_path) + UI.user_error!("❌ 产物 #{old_apk_file_path} 未生成,构建失败!") + end File.rename(old_apk_file_path, new_apk_file_path) end @@ -171,7 +177,13 @@ platform :android do new_bundle_file_path = File.join($path_bundle_output_dir , "/skyRelease/starlock-sky-release-"+$current_tag+".aab") print_log "old_bundle_file_path: #{old_bundle_file_path}" print_log "new_bundle_file_path: #{new_bundle_file_path}" + unless File.exist?(old_bundle_file_path) + UI.user_error!("❌ 产物 #{old_bundle_file_path} 未生成,构建失败!") + end File.rename(old_bundle_file_path, new_bundle_file_path) + unless File.exist?(new_bundle_file_path) + UI.user_error!("❌ 产物 #{new_bundle_file_path} 未生成,构建失败!") + end sh('cp',new_bundle_file_path,$path_apk_output_dir) end