fix:恢复原有ci
This commit is contained in:
parent
4787759694
commit
48603c7daa
@ -18,10 +18,9 @@ variables:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "develop"
|
||||
- if: $CI_COMMIT_BRANCH == "release"
|
||||
- if: $CI_COMMIT_BRANCH == "release_sky"
|
||||
- if: $CI_COMMIT_BRANCH =~ /feat_[a-zA-Z]+/
|
||||
- if: $CI_COMMIT_BRANCH == "canary_release"
|
||||
- if: $CI_COMMIT_TAG =~ /^(sky_)?v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+\.[0-9]+)?$/
|
||||
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+\.[0-9]+)?$/
|
||||
|
||||
.notify_rule:
|
||||
tags:
|
||||
@ -30,7 +29,6 @@ variables:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "develop"
|
||||
- if: $CI_COMMIT_BRANCH == "release"
|
||||
- if: $CI_COMMIT_BRANCH == "release_sky"
|
||||
- if: $CI_COMMIT_BRANCH =~ /feat_[a-zA-Z]+/
|
||||
|
||||
.generate_tag_rule:
|
||||
@ -39,7 +37,6 @@ variables:
|
||||
- flutter
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "master"
|
||||
- if: $CI_COMMIT_BRANCH == "master_sky"
|
||||
|
||||
.generate_next_version_rule:
|
||||
tags:
|
||||
@ -48,7 +45,6 @@ variables:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "develop"
|
||||
- if: $CI_COMMIT_BRANCH == "release"
|
||||
- if: $CI_COMMIT_BRANCH == "release_sky"
|
||||
- if: $CI_COMMIT_BRANCH == "canary_release"
|
||||
- if: $CI_COMMIT_BRANCH =~ /feat_[a-zA-Z]+/
|
||||
|
||||
@ -64,34 +60,10 @@ variables:
|
||||
.setup_fastlane_android:
|
||||
extends: .build_rule
|
||||
before_script:
|
||||
- rm -rf ~/.gem ~/.bundle vendor/bundle_android
|
||||
- export GEM_HOME="$PWD/vendor/bundle_android"
|
||||
- export GEM_PATH="$PWD/vendor/bundle_android"
|
||||
- export PATH="$HOME/.rbenv/bin:$PATH"
|
||||
- eval "$(rbenv init -)"
|
||||
- rbenv global 2.7.8
|
||||
- export PATH="$HOME/.rbenv/shims:$PATH"
|
||||
- which ruby # 输出当前使用的ruby路径,便于调试
|
||||
- ruby -v # 输出当前ruby版本,便于调试
|
||||
- gem sources --add https://rubygems.org || true # 保证官方源始终存在
|
||||
- 'echo -e "---\n:backtrace: false\n:bulk_threshold: 1000\n:sources:\n- https://rubygems.org\n:update_sources: true\n:verbose: true" > ~/.gemrc'
|
||||
- bundle -v || gem install bundler --source https://rubygems.org/
|
||||
- ls -li
|
||||
- export NEXT_VERSION="$(cat app_new.version)"
|
||||
- bash scripts/bundle_install_and_auto_add.sh android/Gemfile vendor/bundle_android "bundle exec fastlane -v"
|
||||
- gem pristine --all || true # 修复所有未编译的gem扩展
|
||||
script:
|
||||
# 输出调试信息,便于后续排查环境问题
|
||||
- echo "=== DEBUG INFO (android) ==="
|
||||
- which ruby
|
||||
- ruby -v
|
||||
- which gem
|
||||
- gem -v
|
||||
- echo $PATH
|
||||
- env
|
||||
- bash android/build.sh
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-apk/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-apk/ ]; then ls -lh build/app/outputs/flutter-apk/; else echo "❌ 产物目录 build/app/outputs/flutter-apk/ 未生成!"; fi
|
||||
# - flutter pub get
|
||||
- bundle install --gemfile android/Gemfile --quiet
|
||||
cache:
|
||||
paths:
|
||||
- app_new.version
|
||||
@ -99,34 +71,10 @@ variables:
|
||||
.setup_fastlane_ios:
|
||||
extends: .build_rule
|
||||
before_script:
|
||||
- rm -rf ~/.gem ~/.bundle vendor/bundle_ios
|
||||
- export GEM_HOME="$PWD/vendor/bundle_ios"
|
||||
- export GEM_PATH="$PWD/vendor/bundle_ios"
|
||||
- export PATH="$HOME/.rbenv/bin:$PATH"
|
||||
- eval "$(rbenv init -)"
|
||||
- rbenv global 2.7.8
|
||||
- export PATH="$HOME/.rbenv/shims:$PATH"
|
||||
- which ruby # 输出当前使用的ruby路径,便于调试
|
||||
- ruby -v # 输出当前ruby版本,便于调试
|
||||
- gem sources --add https://rubygems.org || true # 保证官方源始终存在
|
||||
- 'echo -e "---\n:backtrace: false\n:bulk_threshold: 1000\n:sources:\n- https://rubygems.org\n:update_sources: true\n:verbose: true" > ~/.gemrc'
|
||||
- bundle -v || gem install bundler --source https://rubygems.org/
|
||||
- ls -li
|
||||
- export NEXT_VERSION="$(cat app_new.version)"
|
||||
- bash scripts/bundle_install_and_auto_add.sh ios/Gemfile vendor/bundle_ios "bundle exec fastlane -v"
|
||||
- gem pristine --all || true # 修复所有未编译的gem扩展
|
||||
script:
|
||||
# 输出调试信息,便于后续排查环境问题
|
||||
- echo "=== DEBUG INFO (ios) ==="
|
||||
- which ruby
|
||||
- ruby -v
|
||||
- which gem
|
||||
- gem -v
|
||||
- echo $PATH
|
||||
- env
|
||||
- bash ios/build.sh
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-ipa/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-ipa/ ]; then ls -lh build/app/outputs/flutter-ipa/; else echo "❌ 产物目录 build/app/outputs/flutter-ipa/ 未生成!"; fi
|
||||
# - flutter pub get
|
||||
- bundle install --gemfile ios/Gemfile --quiet
|
||||
cache:
|
||||
paths:
|
||||
- app_new.version
|
||||
@ -165,17 +113,7 @@ generate_next_version:
|
||||
build_android:
|
||||
stage: build-artifacts
|
||||
extends: .setup_fastlane_android
|
||||
script:
|
||||
- echo "=== DEBUG INFO (android) ==="
|
||||
- which ruby
|
||||
- ruby -v
|
||||
- which gem
|
||||
- gem -v
|
||||
- echo $PATH
|
||||
- env
|
||||
- bash android/build.sh
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-apk/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-apk/ ]; then ls -lh build/app/outputs/flutter-apk/; else echo "❌ 产物目录 build/app/outputs/flutter-apk/ 未生成!"; fi
|
||||
script: bash android/build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- build/app/outputs/flutter-apk/
|
||||
@ -183,21 +121,8 @@ build_android:
|
||||
build_ios:
|
||||
stage: build-artifacts
|
||||
extends: .setup_fastlane_ios
|
||||
needs:
|
||||
- build_android
|
||||
dependencies:
|
||||
- build_android
|
||||
script:
|
||||
- echo "=== DEBUG INFO (ios) ==="
|
||||
- which ruby
|
||||
- ruby -v
|
||||
- which gem
|
||||
- gem -v
|
||||
- echo $PATH
|
||||
- env
|
||||
- bash ios/build.sh
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-ipa/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-ipa/ ]; then ls -lh build/app/outputs/flutter-ipa/; else echo "❌ 产物目录 build/app/outputs/flutter-ipa/ 未生成!"; fi
|
||||
artifacts:
|
||||
paths:
|
||||
- build/app/outputs/flutter-ipa
|
||||
@ -220,10 +145,6 @@ create-release:
|
||||
- bash release_description_generator.sh
|
||||
- export RELEASE_DESCRIPTION="$(cat changelog.md)"
|
||||
- echo "${RELEASE_DESCRIPTION}"
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-apk/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-apk/ ]; then ls -lh build/app/outputs/flutter-apk/; else echo "❌ 产物目录 build/app/outputs/flutter-apk/ 未生成!"; fi
|
||||
- echo "=== [产物检查] build/app/outputs/flutter-ipa/ 目录内容如下 ==="
|
||||
- if [ -d build/app/outputs/flutter-ipa/ ]; then ls -lh build/app/outputs/flutter-ipa/; else echo "❌ 产物目录 build/app/outputs/flutter-ipa/ 未生成!"; fi
|
||||
script:
|
||||
- export StarLock_VERSION=${CI_COMMIT_TAG#*-}
|
||||
- echo "Uploading StarLock-${StarLock_VERSION} packages to
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "fastlane"
|
||||
gem 'nkf', '0.2.0'
|
||||
|
||||
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
||||
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
||||
|
||||
@ -44,29 +44,22 @@ platform :android do
|
||||
print_header '🏁 Before All'
|
||||
print_log $current_branch
|
||||
print_log $current_tag
|
||||
print_log $path_file_preview_apk_default
|
||||
print_log $path_file_release_apk_default
|
||||
print_log $path_file_preview_apk_copy
|
||||
print_log $path_file_release_apk_copy
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
end
|
||||
# RubyGems/bundle环境相关日志
|
||||
sh('which ruby')
|
||||
sh('ruby -v')
|
||||
sh('which gem')
|
||||
sh('gem -v')
|
||||
sh('gem sources -l')
|
||||
sh('which bundle')
|
||||
sh('bundle -v')
|
||||
sh('bundle config')
|
||||
sh('env | grep GEM || true')
|
||||
sh('env | grep BUNDLE || true')
|
||||
sh('env | grep CI_ || true')
|
||||
end
|
||||
|
||||
desc "Submit a new Beta Build to Pgy Beta"
|
||||
lane :beta do |options|
|
||||
flavor = options[:flavor]
|
||||
env = options[:env]
|
||||
flavor = 'sky'
|
||||
UI.user_error!("flavor is required") unless flavor
|
||||
UI.user_error!("env is required") unless env
|
||||
print_log "build sky on #{env}"
|
||||
print_log "build #{flavor} on #{env}"
|
||||
build_number = Time.now.strftime("%Y%m%d%H")
|
||||
print_log "BuildNo #{build_number}"
|
||||
build_version = $next_version
|
||||
@ -76,28 +69,11 @@ platform :android do
|
||||
print_log "last_git_commit_short_hash #{short_hash}"
|
||||
remove_zone_pre_build(zone:"com")
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter","pub","get")
|
||||
end
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "sky_#{env}", "-t", "lib/main_sky_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
end
|
||||
old_file_path = File.join($path_apk_output_dir, "app-sky_#{env}-release.apk")
|
||||
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} 未生成,构建失败!")
|
||||
sh("flutter","pub","get")
|
||||
sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}_#{env}", "-t", "lib/main_#{flavor}_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
end
|
||||
old_file_path = File.join($path_apk_output_dir, "app-#{flavor}_#{env}-release.apk")
|
||||
new_file_path = File.join($path_apk_output_dir, "starlock-#{flavor}-preview-#{build_version}.apk")
|
||||
File.rename(old_file_path, new_file_path)
|
||||
logs = changelog_from_git_commits(
|
||||
pretty: '- %s (%cn)',
|
||||
@ -109,81 +85,46 @@ platform :android do
|
||||
|
||||
desc "Build & upload a new version to Gitlab Release"
|
||||
lane :release_apk do |options|
|
||||
flavor = 'sky'
|
||||
print_log "build flavor for: sky"
|
||||
flavor = options[:flavor]
|
||||
UI.user_error!("flavor is required") unless flavor
|
||||
print_log "build flavor for: #{flavor}"
|
||||
build_number = Time.now.strftime("%Y%m%d%H")
|
||||
print_log "BuildNo #{build_number}"
|
||||
build_version = $current_tag.match(/^(sky_)?v(\d+\.\d+\.\d+)/).captures.last
|
||||
build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0]
|
||||
print_log "buildVersion #{build_version}"
|
||||
commit_hash = last_git_commit
|
||||
short_hash = commit_hash[:abbreviated_commit_hash]
|
||||
print_log "last_git_commit_short_hash #{short_hash}"
|
||||
remove_zone_pre_build(zone:"com")
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter","pub","get")
|
||||
sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
end
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
end
|
||||
old_apk_file_path = File.join($path_apk_output_dir, "app-sky-release.apk")
|
||||
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
|
||||
old_apk_file_path = File.join($path_apk_output_dir, "app-#{flavor}-release.apk")
|
||||
new_apk_file_path = File.join($path_apk_output_dir, "starlock-#{flavor}-release-"+$current_tag+".apk")
|
||||
File.rename(old_apk_file_path, new_apk_file_path)
|
||||
end
|
||||
|
||||
desc "Build & upload a new version to Gitlab Release"
|
||||
lane :release_bundle do |options|
|
||||
flavor = 'sky'
|
||||
print_log "build flavor for: sky"
|
||||
flavor = options[:flavor]
|
||||
UI.user_error!("flavor is required") unless flavor
|
||||
print_log "build flavor for: #{flavor}"
|
||||
build_number = Time.now.strftime("%Y%m%d%H")
|
||||
print_log "BuildNo #{build_number}"
|
||||
build_version = $current_tag.match(/^(sky_)?v(\d+\.\d+\.\d+)/).captures.last
|
||||
build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0]
|
||||
print_log "buildVersion #{build_version}"
|
||||
commit_hash = last_git_commit
|
||||
short_hash = commit_hash[:abbreviated_commit_hash]
|
||||
print_log "last_git_commit_short_hash #{short_hash}"
|
||||
remove_zone_pre_build(zone:"cn")
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter","pub","get")
|
||||
sh("flutter", "build", "appbundle", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
end
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
sh("flutter", "build", "appbundle", "--no-tree-shake-icons", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
sh('ls -lh build/app/outputs/flutter-apk/ || true')
|
||||
sh('ls -lh build/app/outputs/bundle/ || true')
|
||||
end
|
||||
old_bundle_file_path = File.join($path_bundle_output_dir , "/skyRelease/app-sky-release.aab")
|
||||
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
|
||||
old_bundle_file_path = File.join($path_bundle_output_dir , "/#{flavor}Release/app-#{flavor}-release.aab")
|
||||
new_bundle_file_path = File.join($path_bundle_output_dir , "/#{flavor}Release/starlock-#{flavor}-release-"+$current_tag+".aab")
|
||||
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
|
||||
|
||||
|
||||
@ -5,4 +5,3 @@ gem 'cocoapods', '1.14.3'
|
||||
gem 'public_suffix', '~> 4.0'
|
||||
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
||||
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
||||
gem 'nkf', '0.2.0'
|
||||
|
||||
@ -68,55 +68,38 @@ platform :ios do
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
end
|
||||
# RubyGems/bundle环境相关日志
|
||||
sh('which ruby')
|
||||
sh('ruby -v')
|
||||
sh('which gem')
|
||||
sh('gem -v')
|
||||
sh('gem sources -l')
|
||||
sh('which bundle')
|
||||
sh('bundle -v')
|
||||
sh('bundle config')
|
||||
sh('env | grep GEM || true')
|
||||
sh('env | grep BUNDLE || true')
|
||||
sh('env | grep CI_ || true')
|
||||
end
|
||||
|
||||
desc "Build & Deliver to Pgy"
|
||||
lane :beta do |options|
|
||||
flavor = options[:flavor]
|
||||
env = options[:env]
|
||||
flavor = 'sky'
|
||||
UI.user_error!("flavor is required") unless flavor
|
||||
UI.user_error!("env is required") unless env
|
||||
print_log "build sky on #{env}"
|
||||
print_log "build #{flavor} on #{env}"
|
||||
build_number = Time.now.strftime("%Y%m%d%H%M")
|
||||
print_log "Build Commits #{build_number}"
|
||||
build_version = $next_version
|
||||
build_version = $next_version # Time.now.strftime("%Y%m%d%H%M%S")
|
||||
print_log "build_version #{build_version}"
|
||||
commit_hash = last_git_commit
|
||||
short_hash = commit_hash[:abbreviated_commit_hash]
|
||||
print_log "last_git_commit_short_hash #{short_hash}"
|
||||
remove_zone_pre_build(zone:"com")
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter","pub","get")
|
||||
end
|
||||
Dir.chdir ".." do
|
||||
sh("bundle", "exec" ,"pod", "install")
|
||||
end
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "sky", "-t", "lib/main_sky_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
end
|
||||
gym_scheme_preview="sky"
|
||||
print_log "gym_scheme_preview sky"
|
||||
gym_configuration = "#{env}-release-sky"
|
||||
#set_bundle_short_version('./Runner/Info.plist', $current_branch)
|
||||
gym_scheme_preview="#{flavor}"
|
||||
print_log "gym_scheme_preview #{gym_scheme_preview}"
|
||||
gym_configuration = "#{env}-release-#{flavor}"
|
||||
print_log "gym_configuration #{gym_configuration}"
|
||||
ipa_default_filename = "starlock-sky-preview-#{build_version}.ipa"
|
||||
ipa_default_filename = "starlock-#{flavor}-preview-#{build_version}.ipa"
|
||||
print_log "ipa_default_filename #{ipa_default_filename}"
|
||||
gym(
|
||||
scheme: gym_scheme_preview,
|
||||
@ -127,6 +110,8 @@ platform :ios do
|
||||
export_method: "ad-hoc",
|
||||
export_options: {
|
||||
provisioningProfiles: {
|
||||
"com.xhjcn.lock.dev" => "Adhoc_com.xhjcn.lock.dev.mobileprovision",
|
||||
"com.xhjcn.lock.pre" => "Adhoc_com.xhjcn.lock.pre.mobileprovision",
|
||||
"com.skychip.lock.dev" => "Adhoc_com.skychip.lock.dev.mobileprovision",
|
||||
"com.skychip.lock.pre" => "Adhoc_com.skychip.lock.pre.mobileprovision",
|
||||
}
|
||||
@ -142,42 +127,31 @@ platform :ios do
|
||||
|
||||
desc "Build & Deliver to App Store Connect"
|
||||
lane :release_ipa do |options|
|
||||
flavor = 'sky'
|
||||
print_log "build flavor: sky"
|
||||
flavor = options[:flavor]
|
||||
UI.user_error!("flavor is required") unless flavor
|
||||
print_log "build flavor: #{flavor}"
|
||||
build_number = Time.now.strftime("%Y%m%d%H%M")
|
||||
print_log "Build Commits #{build_number}"
|
||||
m = $current_tag.match(/^(sky_)?v(\d+\.\d+\.\d+)/)
|
||||
if m
|
||||
build_version = m.captures.last
|
||||
else
|
||||
UI.user_error!("Tag格式不正确,无法提取版本号: #{$current_tag}")
|
||||
end
|
||||
build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0]
|
||||
print_log "build_version #{build_version}"
|
||||
commit_hash = last_git_commit
|
||||
short_hash = commit_hash[:abbreviated_commit_hash]
|
||||
print_log "last_git_commit_short_hash #{short_hash}"
|
||||
remove_zone_pre_build(zone:"com")
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter","pub","get")
|
||||
end
|
||||
Dir.chdir ".." do
|
||||
sh("bundle", "exec" ,"pod", "install")
|
||||
end
|
||||
Dir.chdir "../.." do
|
||||
sh('pwd')
|
||||
sh('ls -lh')
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
sh('ls -lh build/app/outputs/flutter-ipa/ || true')
|
||||
sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}")
|
||||
end
|
||||
gym_scheme_release="sky"
|
||||
print_log "gym_scheme_release sky"
|
||||
gym_configuration = "Release-sky"
|
||||
gym_scheme_release="#{flavor}"
|
||||
print_log "gym_scheme_release #{gym_scheme_release}"
|
||||
gym_configuration = "Release-#{flavor}"
|
||||
print_log "gym_configuration #{gym_configuration}"
|
||||
ipa_default_filename = "starlock-sky-release-"+$current_tag+".ipa"
|
||||
ipa_default_filename = "starlock-#{flavor}-release-"+$current_tag+".ipa"
|
||||
print_log "ipa_default_filename #{ipa_default_filename}"
|
||||
gym(
|
||||
scheme: gym_scheme_release,
|
||||
@ -188,6 +162,7 @@ platform :ios do
|
||||
export_method: "app-store",
|
||||
export_options: {
|
||||
provisioningProfiles: {
|
||||
"com.xhjcn.lock" => "Appstore_com.xhjcn.lock.mobileprovision",
|
||||
"com.skychip.lock" => "Appstore_com.skychip.lock.mobileprovision",
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
# 用法: bash scripts/bundle_install_and_auto_add.sh <gemfile_path> <bundle_path> <main_cmd>
|
||||
# 例如: bash scripts/bundle_install_and_auto_add.sh ios/Gemfile vendor/bundle_ios "bundle exec fastlane -v"
|
||||
|
||||
GEMFILE_PATH="$1"
|
||||
BUNDLE_PATH="$2"
|
||||
MAIN_CMD="$3"
|
||||
|
||||
if [ -z "$GEMFILE_PATH" ] || [ -z "$BUNDLE_PATH" ] || [ -z "$MAIN_CMD" ]; then
|
||||
echo "用法: $0 <gemfile_path> <bundle_path> <main_cmd>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 保证rubygems.org官方源始终存在(开头)
|
||||
gem sources --add https://rubygems.org || true
|
||||
|
||||
max_auto_add=3
|
||||
add_count=0
|
||||
success=0
|
||||
|
||||
# 1. 检查并自动补全Gemfile缺失依赖
|
||||
while [ $add_count -lt $max_auto_add ]; do
|
||||
echo "[INFO] 第$((add_count+1))次尝试运行主命令: $MAIN_CMD (仅捕获缺失gem)"
|
||||
$MAIN_CMD > bundle_missing_gem.log 2>&1 && success=1 && break
|
||||
missing_gem=$(grep -o "Could not find [^ ]*" bundle_missing_gem.log | awk '{print $4}' | head -n1)
|
||||
if [ -n "$missing_gem" ]; then
|
||||
if ! grep -q "gem '$missing_gem'" "$GEMFILE_PATH"; then
|
||||
echo "gem '$missing_gem'" >> "$GEMFILE_PATH"
|
||||
echo "[AUTO] Gemfile已自动补全: $missing_gem"
|
||||
else
|
||||
echo "[WARN] Gemfile已包含 $missing_gem,但依然缺失,可能是平台或缓存问题"
|
||||
fi
|
||||
else
|
||||
echo "[INFO] 未检测到缺失gem,或主命令已成功。"
|
||||
break
|
||||
fi
|
||||
add_count=$((add_count+1))
|
||||
sleep 2
|
||||
echo "[WARN] 第$add_count 次自动补全后重试..."
|
||||
done
|
||||
|
||||
if [ $success -eq 1 ]; then
|
||||
echo "[SUCCESS] 所有依赖已补全,主命令执行成功。"
|
||||
# 再次保证rubygems.org官方源始终存在(结尾)
|
||||
gem sources --add https://rubygems.org || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 2. 只用 rubygems.org 官方源进行 bundle install
|
||||
bundle config mirror.https://rubygems.org https://rubygems.org
|
||||
bundle config set --local path "$BUNDLE_PATH"
|
||||
bundle install --gemfile "$GEMFILE_PATH"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[SUCCESS] 官方源 bundle install 成功"
|
||||
else
|
||||
echo "[FATAL] 官方源 bundle install 失败,请检查网络或Gemfile配置。"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# 3. 最后再执行一次主命令校验
|
||||
$MAIN_CMD || { echo "[FATAL] 主命令依然失败,请人工检查Gemfile和依赖环境。"; exit 3; }
|
||||
# 再次保证rubygems.org官方源始终存在(结尾)
|
||||
gem sources --add https://rubygems.org || true
|
||||
echo "[SUCCESS] 所有依赖已补全,主命令执行成功。"
|
||||
exit 0
|
||||
@ -15,17 +15,15 @@ if [ "$tags_length" -lt 1 ]; then
|
||||
next_tag="v1.0.0"
|
||||
else
|
||||
newest_tag=$(echo "$tags" | head -n 1)
|
||||
# 去除已有的sky_前缀,防止重复
|
||||
base_tag=${newest_tag#sky_}
|
||||
IFS='.' read -r major minor patch <<< "$base_tag"
|
||||
IFS='.' read -r major minor patch <<< "$newest_tag"
|
||||
major="${major#v}"
|
||||
compare_json=""
|
||||
if [[ "$1" == "generate_tag" ]];then
|
||||
echo "generate_tag:$newest_tag-to-master_sky\n"
|
||||
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=$newest_tag&to=master_sky")
|
||||
echo "generate_tag:$newest_tag-to-master\n"
|
||||
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=$newest_tag&to=master")
|
||||
elif [[ "$1" == "generate_version" ]]; then
|
||||
echo "generate_version:master_sky-to-$CI_COMMIT_BRANCH\n"
|
||||
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=master_sky&to=$CI_COMMIT_BRANCH")
|
||||
echo "generate_version:master-to-$CI_COMMIT_BRANCH\n"
|
||||
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=master&to=$CI_COMMIT_BRANCH")
|
||||
fi
|
||||
echo "compare_json:$compare_json\n"
|
||||
new_patch=$patch
|
||||
@ -47,13 +45,6 @@ else
|
||||
done < <(echo "$compare_json" | jq -c '.commits[] | {id: .id, message: .message}')
|
||||
next_tag="v$major.$new_minor.$new_patch"
|
||||
fi
|
||||
|
||||
# 生成新tag名时,若在master_sky分支,加前缀sky_
|
||||
branch_name="$CI_COMMIT_BRANCH"
|
||||
if [[ "$branch_name" == "master_sky" ]]; then
|
||||
next_tag="sky_${next_tag}"
|
||||
fi
|
||||
|
||||
echo "New Tag:$newest_tag;New version: $next_tag;command: $1"
|
||||
if [[ "$1" == "generate_tag" ]];then
|
||||
if [ "$next_tag" == "$newest_tag" ]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user