Check if a release notes file for the current version exists and use it when releasing to Firebase. If one for the version code doesn’t exist then check for the default.txt
file and use that. If that also doesn’t exist then use the default release text message.
File.exist()
to check if a file exists. File.exists()
(with an S at the end) is deprecatedandroid_get_version_code()
metadata/android/en-GB/changelogs/
. Every language gets its own folder'metadata/android/en-GB/changelogs/' + ANDROID_BUILD + '.txt'
Check if a file exists
# Does this file already exist?
File.exist?("log.txt")
Get the path for the version specific release notes file
release_notes_file_path = 'metadata/android/en-GB/changelogs/' + ANDROID_BUILD + '.txt' # metadata/android/en-GB/changelogs/18.txt
if File.exist?(release_notes_file_path)
puts "file exists"
else
puts "file #{release_notes_file_path} does not exist"
end
1android_version_code = android_get_version_code(
2 gradle_file: "android/app/build.gradle"
3)
4
5# get the path for the relevat release notes file
6release_notes_version_file_path = 'metadata/android/en-GB/changelogs/' + ANDROID_BUILD + '.txt' # metadata/android/en-GB/changelogs/18.txt
7release_notes_default_file_path = 'metadata/android/en-GB/changelogs/default.txt'
8release_notes_default_text = "Bug fixes and performance improvements"
9
10if File.exist?(release_notes_version_file_path)
11 puts "version file exists #{release_notes_version_file_path}"
12elsif File.exist?(release_notes_default_file_path)
13 puts "default file exists #{release_notes_default_file_path}"
14else
15 puts "neither #{release_notes_version_file_path}, nor #{release_notes_default_file_path} exist"
16end
1android_version_code = android_get_version_code(
2 gradle_file: "android/app/build.gradle"
3)
4
5# get the path for the relevat release notes file
6release_notes_version_file_path = 'metadata/android/en-GB/changelogs/' + ANDROID_BUILD + '.txt' # metadata/android/en-GB/changelogs/18.txt
7release_notes_default_file_path = 'metadata/android/en-GB/changelogs/default.txt'
8release_notes_default_text = "Bug fixes and performance improvements"
9
10if File.exist?(release_notes_version_file_path)
11 puts "version file exists #{release_notes_version_file_path}"
12elsif File.exist?(release_notes_default_file_path)
13 puts "default file exists #{release_notes_default_file_path}"
14else
15 puts "neither #{release_notes_version_file_path}, nor #{release_notes_default_file_path} exist"
16end
17
18firebase_app_distribution(
19 app: ENV["FIREBASE_APP_ID"],
20 # testers: ENV["FIREBASE_TESTERS"],
21 testers: "aamnah@aamnah.com",
22 # groups: ENV['FIREBASE_GROUPS'],
23 apk_path: "android/app/build/outputs/apk/release/app-release.apk"
24
25 # release_notes: ENV['DEFAULT_RELEASE_NOTE'],
26 if File.exist?(release_notes_version_file_path)
27 release_notes_file: "#{release_notes_version_file_path}"
28 elsif File.exist?(release_notes_default_file_path)
29 release_notes_file: "#{release_notes_default_file_path}"
30 else
31 release_notes: "#{release_notes_default_text}"
32 end
33)