TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

Fastlane - Check if a release notes file exists (for Android)

March 10, 2021

Ziel

Release Notes fuer Android Builds automatisch waehlen:

  1. Datei fuer aktuelle versionCode
  2. default.txt
  3. 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, nutze File.exist?
  • android_get_version_code kommt aus fastlane-plugin-versioning_android

Links