diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 95a0120e..fe379a16 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -48,6 +48,7 @@ app_name = i18nEnJSON['app']['name'] app_resources_path = ENV["APP_RESOURCES"] || "App_Resources" # based on nativescript.config.js !!! app_build_path = ENV["APP_BUILD_PATH"] || "platforms" # based on nativescript.config.js !!! metadata_path = ENV["SUPPLY_METADATA_PATH"] || "metadata" +metadata_languages = ENV["SUPPLY_METADATA_LANGUAGES"] || ["en-US", "fr-FR"] metadata_path_realpath = File.join(project_root_path, 'fastlane', metadata_path) tag_prefix = ENV["TAG_PREFIX"] || "" @@ -510,12 +511,20 @@ platform :android do puts "current dir: #{Dir.getwd}" puts "metadata_dir: #{metadata_dir}" system 'mkdir', '-p', metadata_dir - files = [File.join(metadata_dir, "fr-FR/changelogs/#{version}.txt"), File.join(metadata_dir, "en-US/changelogs/#{version}.txt")] - writeFileIfNotExist(files[0], changelog) - writeFileIfNotExist(files[1], changelog) + files = [] + metadata_languages.each { |lang| + changelogFolderPath = File.join(metadata_dir, lang, "changelogs") + if (Dir.exist?(changelogFolderPath)) + changelogFilePath = File.join(changelogFolderPath, lang, "#{version}.txt") + writeFileIfNotExist(changelogFilePath, changelog) + files.push(changelogFilePath) + end + } # Create a new branch and upload a PR for it. - git_add(path: files) - git_commit(path: files, message: "#{version} release notes", allow_nothing_to_commit: true) + if (files.length > 0) + git_add(path: files) + git_commit(path: files, message: "#{version} release notes", allow_nothing_to_commit: true) + end # sh("git add #{metadata_dir}; git commit -m '#{version} release notes' --allow-empty") end