Files
plezy/android/fastlane/Fastfile
T

54 lines
2.3 KiB
Ruby
Raw Normal View History

2025-11-01 05:50:24 +01:00
require 'dotenv/load'
require 'shellwords'
PROJECT_ROOT = File.expand_path("../..", __dir__)
PROJECT_ROOT_ARG = Shellwords.escape(PROJECT_ROOT)
Dotenv.load(File.join(PROJECT_ROOT, ".env"))
2025-11-01 05:50:24 +01:00
default_platform(:android)
platform :android do
desc "Build and deploy to Google Play Store"
lane :release do
# Get version from pubspec.yaml
pubspec_path = File.join(PROJECT_ROOT, "pubspec.yaml")
2025-11-01 05:50:24 +01:00
pubspec_content = File.read(pubspec_path)
version_match = pubspec_content.match(/version:\s*(.+)\+(\d+)/)
if version_match
version_name = version_match[1].strip
2025-11-01 05:50:24 +01:00
version_code = version_match[2].to_i
UI.message("Using version: #{version_name}+#{version_code}")
2025-11-01 05:50:24 +01:00
else
UI.user_error!("Could not extract version from pubspec.yaml")
2025-11-01 05:50:24 +01:00
end
git_commit = `git -C #{PROJECT_ROOT_ARG} rev-parse --short HEAD`.strip
# Build the Flutter app
sh("cd #{PROJECT_ROOT_ARG} && flutter build appbundle --dart-define=ENABLE_SENTRY=true --dart-define=GIT_COMMIT=#{git_commit} --dart-define=SENTRY_ENVIRONMENT=play-store --dart-define=SENTRY_DIST=play-store --obfuscate --split-debug-info=debug-info/android-aab --extra-gen-snapshot-options=--save-obfuscation-map=debug-info/android-aab/obfuscation.map.json")
sh("cd #{PROJECT_ROOT_ARG} && SENTRY_DIST=play-store ./scripts/upload-symbols.sh android-aab")
2026-03-03 17:29:29 +01:00
upload_to_play_store(
track: "production",
release_status: "completed",
version_code: version_code,
aab: "../build/app/outputs/bundle/release/app-release.aab"
)
2026-03-02 07:29:21 +01:00
# Build universal APK for Amazon Appstore (doesn't accept AABs, excludes x86 via env var)
sh("cd #{PROJECT_ROOT_ARG} && AMAZON=1 flutter build apk --release --dart-define=ENABLE_SENTRY=true --dart-define=GIT_COMMIT=#{git_commit} --dart-define=SENTRY_ENVIRONMENT=amazon --dart-define=SENTRY_DIST=amazon --obfuscate --split-debug-info=debug-info/android-apk --extra-gen-snapshot-options=--save-obfuscation-map=debug-info/android-apk/obfuscation.map.json")
sh("cd #{PROJECT_ROOT_ARG} && SENTRY_DIST=amazon ./scripts/upload-symbols.sh android-apk")
2026-02-20 09:58:03 +01:00
upload_to_amazon_appstore(
2026-02-20 09:58:03 +01:00
apk_paths: [
2026-03-01 03:47:46 +01:00
"../build/app/outputs/flutter-apk/app-release.apk"
2026-02-20 09:58:03 +01:00
],
overwrite_upload: true,
2026-02-26 13:19:01 +01:00
overwrite_upload_mode: 'reuse',
changes_not_sent_for_review: true
)
2025-11-01 05:50:24 +01:00
end
end