Fastlane - Check if a release notes file exists (for Android)
March 10, 2021
Ziel
Release Notes fuer Android Builds automatisch waehlen:
- Datei fuer aktuelle
versionCode default.txt- Fallback Text
Kontext
Play Store Changelogs liegen in:
code
fastlane/metadata/android/en-GB/changelogs/<VERSION_CODE>.txt
Ruby: File.exist?
code
File.exist?("metadata/android/en-GB/changelogs/18.txt")
Beispiel Lane
code
android_version_code = android_get_version_code(
gradle_file: "android/app/build.gradle"
)
release_notes_version_file = "metadata/android/en-GB/changelogs/#{android_version_code}.txt"
release_notes_default_file = "metadata/android/en-GB/changelogs/default.txt"
release_notes_default_text = "Bug fixes and performance improvements"
release_notes = if File.exist?(release_notes_version_file)
{ release_notes_file: release_notes_version_file }
elsif File.exist?(release_notes_default_file)
{ release_notes_file: release_notes_default_file }
else
{ release_notes: release_notes_default_text }
end
firebase_app_distribution(
app: ENV["FIREBASE_APP_ID"],
testers: "team@example.com",
apk_path: "android/app/build/outputs/apk/release/app-release.apk",
**release_notes
)
Hinweise
File.exists?ist deprecated, nutzeFile.exist?android_get_version_codekommt ausfastlane-plugin-versioning_android