Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _None_

### Internal Changes

_None_
- Improved efficiency and refined the logs of the `promo_screenshots` action. [#685]
- Updated minimum Fastlane requirement to 2.231.0. [#685]

## 13.8.1

Expand Down
71 changes: 38 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PATH
buildkit (~> 1.5)
chroma (= 0.2.0)
diffy (~> 3.3)
fastlane (~> 2.213)
fastlane (~> 2.231)
git (~> 1.3)
google-cloud-storage (~> 1.31)
java-properties (~> 0.3.0)
Expand All @@ -22,10 +22,8 @@ PATH
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.7)
base64
nkf
rexml
CFPropertyList (3.0.8)
abbrev (0.1.2)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
Expand All @@ -38,37 +36,37 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
addressable (2.8.8)
public_suffix (>= 2.0.2, < 8.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.17)
ast (2.4.2)
atomos (0.1.3)
aws-eventstream (1.4.0)
aws-partitions (1.1196.0)
aws-sdk-core (3.240.0)
aws-partitions (1.1206.0)
aws-sdk-core (3.241.4)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.118.0)
aws-sdk-core (~> 3, >= 3.239.1)
aws-sdk-kms (1.121.0)
aws-sdk-core (~> 3, >= 3.241.4)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.208.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-s3 (1.212.0)
aws-sdk-core (~> 3, >= 3.241.4)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.3.0)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
bigdecimal (4.0.1)
buildkit (1.6.1)
sawyer (>= 0.6)
buildkite-test_collector (2.9.0)
Expand Down Expand Up @@ -129,6 +127,7 @@ GEM
crack (1.0.0)
bigdecimal
rexml
csv (3.3.5)
danger (9.5.1)
base64 (~> 0.2)
claide (~> 1.0)
Expand Down Expand Up @@ -179,16 +178,16 @@ GEM
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7)
faraday-cookie_jar (0.0.8)
faraday (>= 0.8.0)
http-cookie (~> 1.0.0)
http-cookie (>= 1.0.0)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-em_synchrony (1.0.1)
faraday-excon (1.1.0)
faraday-http-cache (2.5.1)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.1.0)
faraday-multipart (1.2.0)
multipart-post (~> 2.0)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
Expand All @@ -198,15 +197,18 @@ GEM
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.4.0)
fastlane (2.227.0)
fastlane (2.231.0)
CFPropertyList (>= 2.3, < 4.0.0)
abbrev (~> 0.1.2)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
base64 (~> 0.2.0)
bundler (>= 1.17.3, < 5.0.0)
colored (~> 1.2)
commander (~> 4.6)
csv (~> 3.3)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
Expand All @@ -224,9 +226,12 @@ GEM
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
logger (>= 1.6, < 2.0)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
mutex_m (~> 0.3.0)
naturally (~> 2.2)
nkf (~> 0.2.0)
optparse (>= 0.1.1, < 1.0.0)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
Expand All @@ -238,7 +243,7 @@ GEM
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.4.0)
xcpretty (~> 0.4.1)
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
Expand Down Expand Up @@ -295,28 +300,28 @@ GEM
concurrent-ruby (~> 1.0)
java-properties (0.3.0)
jmespath (1.6.2)
json (2.10.2)
jwt (2.10.1)
json (2.18.0)
jwt (2.10.2)
base64
kramdown (2.5.1)
rexml (>= 3.3.9)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.6.6)
logger (1.7.0)
method_source (0.9.2)
mini_magick (4.13.2)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (5.25.5)
molinillo (0.8.0)
multi_json (1.15.0)
multi_json (1.19.1)
multipart-post (2.4.1)
mutex_m (0.3.0)
nanaimo (0.4.0)
nap (1.1.0)
naturally (2.2.1)
naturally (2.3.0)
netrc (0.11.0)
nkf (0.2.0)
nokogiri (1.18.9)
Expand All @@ -328,7 +333,7 @@ GEM
sawyer (~> 0.9)
open4 (1.3.4)
options (2.3.2)
optparse (0.6.0)
optparse (0.8.1)
os (1.1.4)
parallel (1.26.3)
parser (3.3.7.1)
Expand All @@ -346,7 +351,7 @@ GEM
public_suffix (4.0.7)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rake (13.3.1)
rake-compiler (1.2.9)
rake
rchardet (1.9.0)
Expand All @@ -356,7 +361,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.4.2)
rexml (3.4.4)
rmagick (5.5.0)
observer (~> 0.1)
pkg-config (~> 1.4)
Expand Down Expand Up @@ -400,10 +405,10 @@ GEM
faraday (>= 0.17.3, < 3)
securerandom (0.4.1)
security (0.1.5)
signet (0.19.0)
signet (0.21.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
jwt (>= 1.5, < 4.0)
multi_json (~> 1.10)
simctl (1.6.10)
CFPropertyList
Expand Down Expand Up @@ -440,7 +445,7 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.4.0)
xcpretty (0.4.1)
rouge (~> 3.28.0)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
Expand Down
2 changes: 1 addition & 1 deletion fastlane-plugin-wpmreleasetoolkit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'buildkit', '~> 1.5'
spec.add_dependency 'chroma', '0.2.0'
spec.add_dependency 'diffy', '~> 3.3'
spec.add_dependency 'fastlane', '~> 2.213'
spec.add_dependency 'fastlane', '~> 2.231'
spec.add_dependency 'git', '~> 1.3'
spec.add_dependency 'java-properties', '~> 0.3.0'
spec.add_dependency 'nokogiri', '~> 1.11'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def self.run(params)

UI.message("Unable to find device #{entry['device']}.") if device.nil?

UI.verbose("Processing entry:\n#{JSON.pretty_generate(entry)}")

width = device['canvas_size'][0]
height = device['canvas_size'][1]

Expand Down Expand Up @@ -93,7 +95,7 @@ def self.confirm_directory_overwrite(path, description)
FileUtils.rm_rf(path)
Dir.mkdir(path)
else
UI.user_error!("Exiting to avoid overwriting #{description}.")
UI.abort_with_message!("Exiting to avoid overwriting #{description}.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems more appropriate as an exit call resulting from a confirm user input than user_error!.

I'd actually argue we should not crash and simply terminate the execution (return, next). But that's out of scope at the moment because it would require restructuring the entire method to bubble up the intention of terminating. Simply calling return here would only result in the code continuing, which is not what we desire.

end
else
Dir.mkdir(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ def initialize
UI.user_error!(message)
end

UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText')
UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless self.class.draw_text_available?
end

def self.draw_text_available?
return @draw_text_available if defined?(@draw_text_available)

@draw_text_available = system('command -v drawText', %i[out err] => File::NULL)
end

def read_config(config_file_path)
Expand Down Expand Up @@ -287,7 +293,17 @@ def draw_text_to_canvas(canvas, text, width, height, x_position, y_position, fon
begin
temp_text_file = Tempfile.new

Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}")
Actions.sh(
'drawText',
"html=#{text}",
"maxWidth=#{width}",
"maxHeight=#{height}",
"output=#{temp_text_file.path}",
"fontSize=#{font_size}",
"stylesheet=#{stylesheet_path}",
"alignment=#{position}",
log: false
)

text_content = open_image(temp_text_file.path).trim
text_frame = create_image(width, height)
Expand Down Expand Up @@ -407,8 +423,8 @@ def create_image(width, height, background = 'transparent')
working_background = background.frozen? ? background.dup : background
working_background.paint.to_hex

Image.new(width, height) do
self.background_color = working_background
Image.new(width, height) do |info|
info.background_color = working_background
end
end
Comment on lines -410 to 429
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses a deprecation warning. See commit message for more details.


Expand All @@ -432,8 +448,12 @@ def resolve_path(path)
return resolved_path if !resolved_path.nil? && resolved_path.exist?
end

message = "Unable to locate #{path}"
UI.crash!(message)
message = <<~MESSAGE
Unable to locate #{path}.

Did you run the automation to generate the screenshots?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case I go through the same process of pondering why annotating non existing screenshots fails again.

MESSAGE
UI.user_error!(message)
Copy link
Contributor Author

@mokagio mokagio Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used user_error! instead of crash! because it makes less noise in the logs as it doesn't give a stacktrace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one 👍

end

def resolve_text_into_path(text, locale)
Expand All @@ -444,6 +464,7 @@ def resolve_text_into_path(text, locale)
elsif can_resolve_path(localized_file)
resolve_path(localized_file).realpath.to_s
else
UI.important("Could not identify '#{localized_file}' as a file path or the file was not found. Will use its value as a raw string. This may result in undesired annotations.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In testing, I was surprised to find annotated screenshots with a path instead of of text as the title.

The reason was misconfiguration of the path on my end, but the fact remains that the tool, in being flexible, might hide missing files. This can be dangerous if automation runs unsupervised.

We might want to rethink the tool's behavior. But in the meantime, here's a warning in the logs.

Image

(Not sure yet why it's printed twice)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason was misconfiguration of the path on my end, but the fact remains that the tool, in being flexible, might hide missing files. This can be dangerous if automation runs unsupervised.

👍 I agree.


Not sure yet why it's printed twice

I see that if both paths are misconfigured and can't be resolved, we'll then have two warnings as resolve_text_into_path is called twice (draw_caption_to_canvas and draw_text_attachment_to_canvas).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that if both paths are misconfigured

Oh, of course! Thanks @iangmaia !

In my tests, I had hardcoded only one language, but forgot Woo is configured to create promo screenshots for iPhone and iPad. Given the copy is the same, we'll obviously attempt two reads of that localization file. All clear now.

format(text, 'source')
end
end
Expand Down