diff --git a/CHANGELOG.md b/CHANGELOG.md index 22075a2d7..6e93b5385 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Breaking Changes - Remove the `skip_glotpress` parameter from the `ios_bump_version_release` action [#443] +- Remove the `ios_localize_project` and `ios_update_metadata` actions [#447] ### New Features diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb index f6228c9f9..3d91cbd07 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb @@ -15,7 +15,7 @@ def self.run(params) Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_beta_version, @short_version, @new_internal_version) UI.message 'Done!' - Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: false, include_metadata: false) + Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: false) end ##################################################### diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb index aa6ff18dc..1774ba4fa 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb @@ -20,7 +20,7 @@ def self.run(params) Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal) UI.message 'Done!' - Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile, include_metadata: false) + Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile) UI.message 'Done.' end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb index 2cddf478f..986c037f7 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb @@ -30,8 +30,7 @@ def self.run(params) UI.message 'Done!' Fastlane::Helper::Ios::GitHelper.commit_version_bump( - include_deliverfile: !params[:skip_deliver], - include_metadata: false + include_deliverfile: !params[:skip_deliver] ) UI.message 'Done.' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb deleted file mode 100644 index 4c30e07c3..000000000 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Fastlane - module Actions - class IosLocalizeProjectAction < Action - def self.run(params) - UI.message 'Updating project localisation...' - - require_relative '../../helper/ios/ios_git_helper' - other_action.cocoapods() - Fastlane::Helper::Ios::GitHelper.localize_project() - - UI.message 'Done.' - end - - ##################################################### - # @!group Documentation - ##################################################### - - def self.description - 'Gathers the strings to localise. Deprecated' - end - - def self.details - 'Gathers the strings to localise. Deprecated in favor of the new `ios_generate_strings_file_from_code`' - end - - def self.category - :deprecated - end - - def self.deprecated_notes - 'This action is deprecated in favor of `ios_generate_strings_file_from_code`' - end - - def self.authors - ['Automattic'] - end - - def self.is_supported?(platform) - platform == :ios - end - end - end -end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb deleted file mode 100644 index 996671246..000000000 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Fastlane - module Actions - class IosUpdateMetadataAction < Action - def self.run(params) - require_relative '../../helper/ios/ios_git_helper' - - Fastlane::Helper::Ios::GitHelper.update_metadata() - end - - ##################################################### - # @!group Documentation - ##################################################### - - def self.description - 'Downloads translated metadata from the translation system' - end - - def self.details - 'Downloads translated metadata from the translation system' - end - - def self.available_options - end - - def self.output - end - - def self.return_value - end - - def self.authors - ['Automattic'] - end - - def self.is_supported?(platform) - [:ios, :mac].include?(platform) - end - end - end -end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb index 01909b8c1..d37dc3310 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb @@ -9,67 +9,18 @@ module GitHelper # This typically commits and pushes: # - The files in `./config/*` – especially `Version.*.xcconfig` files # - The `fastlane/Deliverfile` file (which contains the `app_version` line) - # - The `//Resources/AppStoreStrings.pot` file, containing a key for that version's release notes # # @env PROJECT_ROOT_FOLDER The path to the git root of the project - # @env PROJECT_NAME The name of the directory containing the project code (especially containing the Resources/ subfolder) # # @param [Bool] include_deliverfile If true (the default), includes the `fastlane/Deliverfile` in files being commited - # @param [Bool] include_metadata If true (the default), includes the `fastlane/download_metadata.swift` file and the `.pot` file (which typically contains an entry or release notes for the new version) # - def self.commit_version_bump(include_deliverfile: true, include_metadata: true) - files_list = [File.join(ENV['PROJECT_ROOT_FOLDER'], 'config', '.')] + def self.commit_version_bump(include_deliverfile: true) + files_list = [File.join(get_from_env!(key: 'PROJECT_ROOT_FOLDER'), 'config', '.')] files_list.append File.join('fastlane', 'Deliverfile') if include_deliverfile - if include_metadata - files_list.append File.join('fastlane', 'download_metadata.swift') - files_list.append File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'Resources', ENV['APP_STORE_STRINGS_FILE_NAME']) - end Fastlane::Helper::GitHelper.commit(message: 'Bump version number', files: files_list, push: true) end - # Calls the `Scripts/localize.py` script in the project root folder and push the `*.strings` files - # - # That script updates the `.strings` files with translations from GlotPress. - # - # @env PROJECT_ROOT_FOLDER The path to the git root of the project - # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file) - # - # @deprecated This method is only used by the `ios_localize_project` action, which is itself deprecated - # in favor of the new `ios_generate_strings_file_from_code` action - # @todo [Next Major] Remove this method once we fully remove `ios_localize_project` - # - def self.localize_project - Action.sh("cd #{get_from_env!(key: 'PROJECT_ROOT_FOLDER')} && ./Scripts/localize.py") - - Fastlane::Helper::GitHelper.commit(message: 'Update strings for localization', files: strings_files, push: true) || UI.message('No new strings, skipping commit') - end - - # Call the `Scripts/update-translations.rb` then the `fastlane/download_metadata` Scripts from the host project folder - # - # @env PROJECT_ROOT_FOLDER The path to the git root of the project - # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file) - # - # @todo Migrate the scripts, currently in each host repo and called by this method, to be helpers and actions - # in the release-toolkit instead, and move this code away from `ios_git_helper`. - # - def self.update_metadata - Action.sh("cd #{get_from_env!(key: 'PROJECT_ROOT_FOLDER')} && ./Scripts/update-translations.rb") - - Fastlane::Helper::GitHelper.commit(message: 'Update translations', files: strings_files, push: false) - - Action.sh('cd fastlane && ./download_metadata.swift') - - Fastlane::Helper::GitHelper.commit(message: 'Update metadata translations', files: './fastlane/metadata/', push: true) - end - - def self.strings_files - project_root = get_from_env!(key: 'PROJECT_ROOT_FOLDER') - project_name = get_from_env!(key: 'PROJECT_NAME') - - Dir.glob(File.join(project_root, project_name, '**', '*.strings')) - end - def self.get_from_env!(key:) ENV.fetch(key) do UI.user_error! "Could not find value for \"#{key}\" in environment." diff --git a/spec/ios_bump_version_release_spec.rb b/spec/ios_bump_version_release_spec.rb index f2a3f882e..70d8bdea9 100644 --- a/spec/ios_bump_version_release_spec.rb +++ b/spec/ios_bump_version_release_spec.rb @@ -23,7 +23,7 @@ skip_deliver = false expect(Fastlane::Helper::Ios::VersionHelper).to receive(:update_fastlane_deliver).with(next_version_short) - expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false) + expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver) run_described_fastlane_action( skip_deliver: skip_deliver, @@ -35,7 +35,7 @@ skip_deliver = true expect(Fastlane::Helper::Ios::VersionHelper).not_to receive(:update_fastlane_deliver) - expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false) + expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver) run_described_fastlane_action( skip_deliver: skip_deliver,