fastlane-plugin-wpmreleasetoolkit 2.2.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +8 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +11 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +10 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +90 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +112 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +10 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +10 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +113 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb +118 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_generate_strings_file_from_code.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +5 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_strings_files.rb +75 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +0 -20
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +8 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +3 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +3 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +108 -173
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +207 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +3 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +1 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +25 -39
- data/bin/drawText +0 -20
- data/ext/drawText/drawText/Assets/style.css +0 -1
- data/ext/drawText/drawText/CoreTextStack.swift +0 -113
- data/ext/drawText/drawText/Helpers/CommandLineHelpers.swift +0 -36
- data/ext/drawText/drawText/Helpers/Extensions.swift +0 -27
- data/ext/drawText/drawText/Helpers/FileSystemHelper.swift +0 -24
- data/ext/drawText/drawText/Stylesheet.swift +0 -48
- data/ext/drawText/drawText/TextImage.swift +0 -100
- data/ext/drawText/drawText/main.swift +0 -61
- data/ext/drawText/drawText Tests/DigitParsingTests.swift +0 -21
- data/ext/drawText/drawText Tests/ExtensionsTests.swift +0 -5
- data/ext/drawText/drawText Tests/Info.plist +0 -22
- data/ext/drawText/drawText Tests/StylesheetTests.swift +0 -31
- data/ext/drawText/drawText Tests/Test Cases/default-stylesheet.txt +0 -10
- data/ext/drawText/drawText Tests/Test Cases/external-styles-sample.css +0 -3
- data/ext/drawText/drawText Tests/Test Cases/external-styles-test.txt +0 -13
- data/ext/drawText/drawText Tests/Test Cases/large-text-block.txt +0 -1
- data/ext/drawText/drawText Tests/Test Cases/regular-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/rtl-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/text-size-adjustment-test.txt +0 -10
- data/ext/drawText/drawText Tests/TextImageTests.swift +0 -99
- data/ext/drawText/drawText Tests/drawText_Tests.swift +0 -14
- data/ext/drawText/drawText.xcodeproj/project.pbxproj +0 -508
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText Tests.xcscheme +0 -57
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText.xcscheme +0 -109
- data/ext/drawText/extconf.rb +0 -36
- data/ext/drawText/makefile.example +0 -8
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +0 -106
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +0 -52
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87b7167d8eeecefac13e31850447419c88d3e2ceca851a89782df561846f4b7b
|
4
|
+
data.tar.gz: 72b18c319cfbac6d39ea939c33cd801f1e777b79996ee617ea0649c0c3bfb420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c46a423eb4eaf0868bc5a6cecb6558a99dcf9f5f7b788bdc4255a2380aea4ed8adbd92d81476feaad00fc394182c70257aa140e7281920348b3ba8878bafba
|
7
|
+
data.tar.gz: 5329bbb8827fd617af2d43dd1c770e2cf9a23e6adce430bf658f2ee68fe11cda3ac1e5d52f76ced293c28f23df3a9315a882cce14ad7f7918c370ed1be07b2e0
|
@@ -36,12 +36,17 @@ module Fastlane
|
|
36
36
|
FastlaneCore::ConfigItem.new(key: :app_strings_path,
|
37
37
|
description: 'The path of the main strings file',
|
38
38
|
optional: false,
|
39
|
-
|
39
|
+
type: String),
|
40
|
+
# The name of this parameter is a bit misleading due to legacy. In practice it's expected to be an Array of Hashes, each describing a library to merge.
|
41
|
+
# See `Fastlane::Helper::Android::LocalizeHelper.merge_lib`'s YARD doc for more details on the keys expected for each Hash.
|
40
42
|
FastlaneCore::ConfigItem.new(key: :libs_strings_path,
|
41
43
|
env_name: 'LOCALIZE_LIBS_STRINGS_PATH',
|
42
|
-
description: 'The list of libs to merge'
|
44
|
+
description: 'The list of libs to merge. ' \
|
45
|
+
+ 'Each item in the provided array must be a Hash with the keys `:library` (The library display name),' \
|
46
|
+
+ '`:strings_path` (The path to the `strings.xml` file of the library) and ' \
|
47
|
+
+ '`:exclusions` (Array of string keys to exclude from merging)',
|
43
48
|
optional: false,
|
44
|
-
|
49
|
+
type: Array),
|
45
50
|
]
|
46
51
|
end
|
47
52
|
|
@@ -8,8 +8,9 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
require_relative '../../helper/android/android_git_helper'
|
10
10
|
|
11
|
-
# Checkout
|
12
|
-
|
11
|
+
# Checkout default branch and update
|
12
|
+
default_branch = params[:default_branch]
|
13
|
+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
|
13
14
|
|
14
15
|
# Check versions
|
15
16
|
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
@@ -80,6 +81,11 @@ module Fastlane
|
|
80
81
|
description: 'Skips confirmation',
|
81
82
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
82
83
|
default_value: false), # the default value if the user didn't provide one
|
84
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
85
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
86
|
+
description: 'Default branch of the repository',
|
87
|
+
type: String,
|
88
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
83
89
|
]
|
84
90
|
end
|
85
91
|
|
@@ -8,7 +8,8 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/android/android_version_helper'
|
9
9
|
require_relative '../../helper/android/android_git_helper'
|
10
10
|
|
11
|
-
|
11
|
+
default_branch = params[:default_branch]
|
12
|
+
other_action.ensure_git_branch(branch: default_branch)
|
12
13
|
|
13
14
|
# Create new configuration
|
14
15
|
new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release
|
@@ -28,9 +29,9 @@ module Fastlane
|
|
28
29
|
UI.message("New version: #{new_short_version}")
|
29
30
|
UI.message("Release branch: #{new_release_branch}")
|
30
31
|
|
31
|
-
# Update local
|
32
|
+
# Update local default branch and create branch from it
|
32
33
|
UI.message 'Creating new branch...'
|
33
|
-
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from:
|
34
|
+
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from: default_branch)
|
34
35
|
UI.message 'Done!'
|
35
36
|
|
36
37
|
UI.message 'Updating app version...'
|
@@ -52,7 +53,13 @@ module Fastlane
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def self.available_options
|
55
|
-
|
56
|
+
[
|
57
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
58
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
59
|
+
description: 'Default branch of the repository',
|
60
|
+
type: String,
|
61
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
62
|
+
]
|
56
63
|
end
|
57
64
|
|
58
65
|
def self.output
|
@@ -11,8 +11,9 @@ module Fastlane
|
|
11
11
|
require_relative '../../helper/android/android_version_helper'
|
12
12
|
require_relative '../../helper/android/android_git_helper'
|
13
13
|
|
14
|
-
# Checkout
|
15
|
-
|
14
|
+
# Checkout default branch and update
|
15
|
+
default_branch = params[:default_branch]
|
16
|
+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
|
16
17
|
|
17
18
|
# Create versions
|
18
19
|
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
|
@@ -23,7 +24,7 @@ module Fastlane
|
|
23
24
|
no_alpha_version_message = "No alpha version configured. If you wish to configure an alpha version please update version.properties to include an alpha key for this app\n"
|
24
25
|
# Ask user confirmation
|
25
26
|
unless params[:skip_confirm]
|
26
|
-
confirm_message = "Building a new release branch starting from
|
27
|
+
confirm_message = "Building a new release branch starting from #{default_branch}.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
27
28
|
confirm_message += current_alpha_version.nil? ? no_alpha_version_message : "Current Alpha version is #{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
28
29
|
confirm_message += "After codefreeze the new version will be: #{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
29
30
|
confirm_message += current_alpha_version.nil? ? '' : "After codefreeze the new Alpha will be: #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
|
@@ -47,7 +48,7 @@ module Fastlane
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def self.details
|
50
|
-
'Updates the
|
51
|
+
'Updates the default branch, checks the app version and ensure the branch is clean'
|
51
52
|
end
|
52
53
|
|
53
54
|
def self.available_options
|
@@ -58,6 +59,11 @@ module Fastlane
|
|
58
59
|
description: 'Skips confirmation before codefreeze',
|
59
60
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
60
61
|
default_value: false), # the default value if the user didn't provide one
|
62
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
63
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
64
|
+
description: 'Default branch of the repository',
|
65
|
+
type: String,
|
66
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
61
67
|
]
|
62
68
|
end
|
63
69
|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class BuildkiteTriggerBuildAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
require 'buildkit'
|
6
|
+
|
7
|
+
UI.message "Triggering build on branch #{params[:branch]}, commit #{params[:commit]}, using pipeline from #{params[:pipeline_file]}"
|
8
|
+
|
9
|
+
pipeline_name = {
|
10
|
+
PIPELINE: params[:pipeline_file]
|
11
|
+
}
|
12
|
+
|
13
|
+
client = Buildkit.new(token: params[:buildkite_token])
|
14
|
+
response = client.create_build(
|
15
|
+
params[:buildkite_organization],
|
16
|
+
params[:buildkite_pipeline],
|
17
|
+
{
|
18
|
+
branch: params[:branch],
|
19
|
+
commit: params[:commit],
|
20
|
+
env: params[:environment].merge(pipeline_name)
|
21
|
+
}
|
22
|
+
)
|
23
|
+
|
24
|
+
response.state == 'scheduled' ? UI.message('Done!') : UI.crash!("Failed to start job\nError: [#{response}]")
|
25
|
+
end
|
26
|
+
|
27
|
+
#####################################################
|
28
|
+
# @!group Documentation
|
29
|
+
#####################################################
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
'Triggers a job on Buildkite'
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(
|
38
|
+
key: :buildkite_token,
|
39
|
+
env_name: 'BUILDKITE_TOKEN',
|
40
|
+
description: 'Buildkite Personal Access Token',
|
41
|
+
type: String,
|
42
|
+
sensitive: true
|
43
|
+
),
|
44
|
+
FastlaneCore::ConfigItem.new(
|
45
|
+
key: :buildkite_organization,
|
46
|
+
env_name: 'BUILDKITE_ORGANIZTION',
|
47
|
+
description: 'The Buildkite organization that contains your pipeline',
|
48
|
+
type: String
|
49
|
+
),
|
50
|
+
FastlaneCore::ConfigItem.new(
|
51
|
+
key: :buildkite_pipeline,
|
52
|
+
env_name: 'BUILDKITE_PIPELINE',
|
53
|
+
description: %(The Buildkite pipeline you'd like to build),
|
54
|
+
type: String
|
55
|
+
),
|
56
|
+
FastlaneCore::ConfigItem.new(
|
57
|
+
key: :branch,
|
58
|
+
description: 'The branch you want to build',
|
59
|
+
type: String
|
60
|
+
),
|
61
|
+
FastlaneCore::ConfigItem.new(
|
62
|
+
key: :commit,
|
63
|
+
description: 'The commit hash you want to build',
|
64
|
+
type: String,
|
65
|
+
default_value: 'HEAD'
|
66
|
+
),
|
67
|
+
FastlaneCore::ConfigItem.new(
|
68
|
+
key: :pipeline_file,
|
69
|
+
description: 'The name of the pipeline file in the project',
|
70
|
+
type: String
|
71
|
+
),
|
72
|
+
FastlaneCore::ConfigItem.new(
|
73
|
+
key: :environment,
|
74
|
+
description: 'Any additional environment variables to provide to the job',
|
75
|
+
type: Hash,
|
76
|
+
default_value: {}
|
77
|
+
),
|
78
|
+
]
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.authors
|
82
|
+
['Automattic']
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.is_supported?(platform)
|
86
|
+
true
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -58,7 +58,7 @@ module Fastlane
|
|
58
58
|
is_string: false),
|
59
59
|
FastlaneCore::ConfigItem.new(key: :locales,
|
60
60
|
env_name: 'FL_DOWNLOAD_METADATA_LOCALES',
|
61
|
-
description: 'The hash with the
|
61
|
+
description: 'The hash with the GlotPress locale and the project locale association',
|
62
62
|
is_string: false),
|
63
63
|
FastlaneCore::ConfigItem.new(key: :source_locale,
|
64
64
|
env_name: 'FL_DOWNLOAD_METADATA_SOURCE_LOCALE',
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require 'digest/sha1'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
S3_UPLOADED_FILE_PATH = :S3_UPLOADED_FILE_PATH
|
8
|
+
end
|
9
|
+
|
10
|
+
class UploadToS3Action < Action
|
11
|
+
def self.run(params)
|
12
|
+
file_path = params[:file]
|
13
|
+
file_name = File.basename(file_path)
|
14
|
+
|
15
|
+
bucket = params[:bucket]
|
16
|
+
key = params[:key] || file_name
|
17
|
+
|
18
|
+
if params[:auto_prefix] == true
|
19
|
+
file_name_hash = Digest::SHA1.hexdigest(file_name)
|
20
|
+
key = [file_name_hash, key].join('/')
|
21
|
+
end
|
22
|
+
|
23
|
+
UI.user_error!("File already exists in S3 bucket #{bucket} at #{key}") if file_is_already_uploaded?(bucket, key)
|
24
|
+
|
25
|
+
UI.message("Uploading #{file_path} to: #{key}")
|
26
|
+
|
27
|
+
File.open(file_path, 'rb') do |file|
|
28
|
+
Aws::S3::Client.new().put_object(
|
29
|
+
body: file,
|
30
|
+
bucket: bucket,
|
31
|
+
key: key
|
32
|
+
)
|
33
|
+
rescue Aws::S3::Errors::ServiceError => e
|
34
|
+
UI.crash!("Unable to upload file to S3: #{e.message}")
|
35
|
+
end
|
36
|
+
|
37
|
+
UI.success('Upload Complete')
|
38
|
+
|
39
|
+
Actions.lane_context[SharedValues::S3_UPLOADED_FILE_PATH] = key
|
40
|
+
|
41
|
+
return key
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.file_is_already_uploaded?(bucket, key)
|
45
|
+
response = Aws::S3::Client.new().head_object(
|
46
|
+
bucket: bucket,
|
47
|
+
key: key
|
48
|
+
)
|
49
|
+
return response[:content_length].positive?
|
50
|
+
rescue Aws::S3::Errors::NotFound
|
51
|
+
return false
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.description
|
55
|
+
'Uploads a given file to S3'
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.authors
|
59
|
+
['Automattic']
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.return_value
|
63
|
+
'Returns the object\'s derived S3 key'
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.details
|
67
|
+
'Uploads a file to S3, and makes a pre-signed URL available in the lane context'
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.available_options
|
71
|
+
[
|
72
|
+
FastlaneCore::ConfigItem.new(
|
73
|
+
key: :bucket,
|
74
|
+
description: 'The bucket that will store the file',
|
75
|
+
optional: false,
|
76
|
+
type: String,
|
77
|
+
verify_block: proc { |bucket| UI.user_error!('You must provide a valid bucket name') if bucket.empty? }
|
78
|
+
),
|
79
|
+
FastlaneCore::ConfigItem.new(
|
80
|
+
key: :key,
|
81
|
+
description: 'The path to the file within the bucket. If `nil`, will default to the `file\'s basename',
|
82
|
+
optional: true,
|
83
|
+
type: String,
|
84
|
+
verify_block: proc { |key|
|
85
|
+
next if key.is_a?(String) && !key.empty?
|
86
|
+
|
87
|
+
UI.user_error!('The provided key must not be empty. Use nil instead if you want to default to the file basename')
|
88
|
+
}
|
89
|
+
),
|
90
|
+
FastlaneCore::ConfigItem.new(
|
91
|
+
key: :file,
|
92
|
+
description: 'The path to the local file on disk',
|
93
|
+
optional: false,
|
94
|
+
type: String,
|
95
|
+
verify_block: proc { |f| UI.user_error!("Path `#{f}` does not exist.") unless File.file?(f) }
|
96
|
+
),
|
97
|
+
FastlaneCore::ConfigItem.new(
|
98
|
+
key: :auto_prefix,
|
99
|
+
description: 'Generate a derived prefix based on the filename that makes it harder to guess the URL of the uploaded object',
|
100
|
+
optional: true,
|
101
|
+
default_value: true,
|
102
|
+
type: Boolean
|
103
|
+
),
|
104
|
+
]
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.is_supported?(platform)
|
108
|
+
true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -8,8 +8,9 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/ios/ios_version_helper'
|
9
9
|
require_relative '../../helper/ios/ios_git_helper'
|
10
10
|
|
11
|
-
# Checkout
|
12
|
-
|
11
|
+
# Checkout default branch and update
|
12
|
+
default_branch = params[:default_branch]
|
13
|
+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
|
13
14
|
|
14
15
|
# Check versions
|
15
16
|
build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
|
@@ -69,6 +70,11 @@ module Fastlane
|
|
69
70
|
description: 'Skips confirmation',
|
70
71
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
71
72
|
default_value: false), # the default value if the user didn't provide one
|
73
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
74
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
75
|
+
description: 'Default branch of the repository',
|
76
|
+
type: String,
|
77
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
72
78
|
]
|
73
79
|
end
|
74
80
|
|
@@ -8,16 +8,17 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/ios/ios_version_helper'
|
9
9
|
require_relative '../../helper/ios/ios_git_helper'
|
10
10
|
|
11
|
-
|
11
|
+
default_branch = params[:default_branch]
|
12
|
+
other_action.ensure_git_branch(branch: default_branch)
|
12
13
|
|
13
14
|
# Create new configuration
|
14
15
|
@new_version = Fastlane::Helper::Ios::VersionHelper.bump_version_release()
|
15
16
|
create_config()
|
16
17
|
show_config()
|
17
18
|
|
18
|
-
# Update local
|
19
|
-
Fastlane::Helper::GitHelper.checkout_and_pull(
|
20
|
-
Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from:
|
19
|
+
# Update local default branch and create branch from it
|
20
|
+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
|
21
|
+
Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from: default_branch)
|
21
22
|
UI.message 'Done!'
|
22
23
|
|
23
24
|
UI.message 'Updating glotPressKeys...' unless params[:skip_glotpress]
|
@@ -64,7 +65,11 @@ module Fastlane
|
|
64
65
|
description: 'Skips Deliver key update',
|
65
66
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
66
67
|
default_value: false), # the default value if the user didn't provide one
|
67
|
-
|
68
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
69
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
70
|
+
description: 'Default branch of the repository',
|
71
|
+
type: String,
|
72
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
68
73
|
]
|
69
74
|
end
|
70
75
|
|
@@ -8,8 +8,9 @@ module Fastlane
|
|
8
8
|
require_relative '../../helper/ios/ios_version_helper'
|
9
9
|
require_relative '../../helper/ios/ios_git_helper'
|
10
10
|
|
11
|
-
# Checkout
|
12
|
-
|
11
|
+
# Checkout default branch and update
|
12
|
+
default_branch = params[:default_branch]
|
13
|
+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
|
13
14
|
|
14
15
|
# Create versions
|
15
16
|
current_version = Fastlane::Helper::Ios::VersionHelper.get_public_version
|
@@ -17,7 +18,7 @@ module Fastlane
|
|
17
18
|
next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(current_version)
|
18
19
|
|
19
20
|
# Ask user confirmation
|
20
|
-
unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from
|
21
|
+
unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from #{default_branch}.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
|
21
22
|
UI.user_error!('Aborted by user request')
|
22
23
|
end
|
23
24
|
|
@@ -37,7 +38,7 @@ module Fastlane
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def self.details
|
40
|
-
'Updates the
|
41
|
+
'Updates the default branch, checks the app version and ensure the branch is clean'
|
41
42
|
end
|
42
43
|
|
43
44
|
def self.available_options
|
@@ -48,6 +49,11 @@ module Fastlane
|
|
48
49
|
description: 'Skips confirmation before codefreeze',
|
49
50
|
is_string: false, # true: verifies the input is a string, false: every kind of value
|
50
51
|
default_value: false), # the default value if the user didn't provide one
|
52
|
+
FastlaneCore::ConfigItem.new(key: :default_branch,
|
53
|
+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
|
54
|
+
description: 'Default branch of the repository',
|
55
|
+
type: String,
|
56
|
+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
|
51
57
|
]
|
52
58
|
end
|
53
59
|
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosDownloadStringsFilesFromGlotpressAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# TODO: Once we introduce the `Locale` POD via #296, check if the param is an array of locales and if so convert it to Hash{glotpress=>lproj}
|
6
|
+
locales = params[:locales]
|
7
|
+
download_dir = params[:download_dir]
|
8
|
+
|
9
|
+
UI.user_error!("The parent directory `#{download_dir}` (which contains all the `*.lproj` subdirectories) must already exist") unless Dir.exist?(download_dir)
|
10
|
+
|
11
|
+
locales.each do |glotpress_locale, lproj_name|
|
12
|
+
# Download the export in the proper `.lproj` directory
|
13
|
+
lproj_dir = File.join(download_dir, "#{lproj_name}.lproj")
|
14
|
+
destination = File.join(lproj_dir, "#{params[:table_basename]}.strings")
|
15
|
+
FileUtils.mkdir(lproj_dir) unless Dir.exist?(lproj_dir)
|
16
|
+
|
17
|
+
Fastlane::Helper::Ios::L10nHelper.download_glotpress_export_file(
|
18
|
+
project_url: params[:project_url],
|
19
|
+
locale: glotpress_locale,
|
20
|
+
filters: params[:filters],
|
21
|
+
destination: destination
|
22
|
+
)
|
23
|
+
# Do a quick check of the downloaded `.strings` file to ensure it looks valid
|
24
|
+
validate_strings_file(destination) unless params[:skip_file_validation]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Validate that a `.strings` file downloaded from GlotPress seems valid and does not contain empty translations
|
29
|
+
def self.validate_strings_file(destination)
|
30
|
+
return unless File.exist?(destination) # If the file failed to download, don't try to validate an non-existing file. We'd already have a separate error for the download failure anyway.
|
31
|
+
|
32
|
+
translations = Fastlane::Helper::Ios::L10nHelper.read_strings_file_as_hash(path: destination)
|
33
|
+
empty_keys = translations.select { |_, value| value.nil? || value.empty? }.keys.sort
|
34
|
+
unless empty_keys.empty?
|
35
|
+
UI.error(
|
36
|
+
"Found empty translations in `#{destination}` for the following keys: #{empty_keys.inspect}.\n" \
|
37
|
+
+ "This is likely a GlotPress bug, and will lead to copies replaced by empty text in the UI.\n" \
|
38
|
+
+ 'Please report this to the GlotPress team, and fix the file locally before continuing.'
|
39
|
+
)
|
40
|
+
end
|
41
|
+
rescue StandardError => e
|
42
|
+
UI.error("Error while validating the file exported from GlotPress (`#{destination}`) - #{e.message.chomp}")
|
43
|
+
end
|
44
|
+
|
45
|
+
#####################################################
|
46
|
+
# @!group Documentation
|
47
|
+
#####################################################
|
48
|
+
|
49
|
+
def self.description
|
50
|
+
'Downloads the `.strings` files from GlotPress for the various locales'
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.details
|
54
|
+
<<~DETAILS
|
55
|
+
Downloads the `.strings` files from GlotPress for the various locales,
|
56
|
+
validates them, and saves them in the relevant `*.lproj` directories for each locale
|
57
|
+
DETAILS
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.available_options
|
61
|
+
[
|
62
|
+
FastlaneCore::ConfigItem.new(key: :project_url,
|
63
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_PROJECT_URL',
|
64
|
+
description: 'URL to the GlotPress project',
|
65
|
+
type: String),
|
66
|
+
FastlaneCore::ConfigItem.new(key: :locales,
|
67
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_LOCALES',
|
68
|
+
description: 'The map of locales to download, each entry of the Hash corresponding to a { glotpress-locale-code => lproj-folder-basename } pair',
|
69
|
+
type: Hash), # TODO: also support an Array of `Locale` POD/struct type when we introduce it later (see #296)
|
70
|
+
FastlaneCore::ConfigItem.new(key: :download_dir,
|
71
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_DOWNLOAD_DIR',
|
72
|
+
description: 'The parent directory containing all the `*.lproj` subdirectories in which the downloaded files will be saved',
|
73
|
+
type: String),
|
74
|
+
FastlaneCore::ConfigItem.new(key: :table_basename,
|
75
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_TABLE_BASENAME',
|
76
|
+
description: 'The basename to save the `.strings` files under',
|
77
|
+
type: String,
|
78
|
+
optional: true,
|
79
|
+
default_value: 'Localizable'),
|
80
|
+
FastlaneCore::ConfigItem.new(key: :filters,
|
81
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_FILTERS',
|
82
|
+
description: 'The GlotPress filters to use when requesting the translations export',
|
83
|
+
type: Hash,
|
84
|
+
optional: true,
|
85
|
+
default_value: { status: 'current' }),
|
86
|
+
FastlaneCore::ConfigItem.new(key: :skip_file_validation,
|
87
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_SKIP_FILE_VALIDATION',
|
88
|
+
description: 'If true, skips the validation of `.strings` files after download',
|
89
|
+
type: Fastlane::Boolean,
|
90
|
+
optional: true,
|
91
|
+
default_value: false),
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.return_type
|
96
|
+
# Describes what type of data is expected to be returned
|
97
|
+
# see RETURN_TYPES in https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/action.rb
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.return_value
|
101
|
+
# Textual description of what the return value is
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.authors
|
105
|
+
['Automattic']
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.is_supported?(platform)
|
109
|
+
[:ios, :mac].include?(platform)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|