Replace ImageMagick with a custom tool written in swift.
This commit is contained in:
committed by
Stefan Ceriu
parent
0c61bfbb80
commit
ef9c538cad
@@ -14,14 +14,14 @@ before_all do
|
||||
ENV["SENTRY_LOG_LEVEL"] = "DEBUG"
|
||||
end
|
||||
|
||||
lane :alpha do
|
||||
lane :build_alpha do
|
||||
app_store_connect_api_key(
|
||||
key_id: ENV["APPSTORECONNECT_KEY_ID"],
|
||||
issuer_id: ENV["APPSTORECONNECT_KEY_ISSUER_ID"],
|
||||
key_content: ENV["APPSTORECONNECT_KEY_CONTENT"]
|
||||
)
|
||||
|
||||
config_xcodegen_alpha()
|
||||
config_alpha()
|
||||
|
||||
code_signing_identity = "Apple Distribution: Vector Creations Limited (7J4U792NQT)"
|
||||
|
||||
@@ -184,7 +184,9 @@ lane :config_nightly do |options|
|
||||
|
||||
release_version = get_version_number(target: "ElementX")
|
||||
|
||||
update_app_icon(caption_text: "#{release_version} (#{build_number})", modulate: "100,20,100")
|
||||
Dir.chdir ".." do
|
||||
sh("swift run tools app-icon-banner Variants/Nightly/Resources/Nightly.xcassets/NightlyAppIcon.appiconset/AppIcon.png --banner-text '#{release_version} (#{build_number})'")
|
||||
end
|
||||
end
|
||||
|
||||
$sentry_retry=0
|
||||
@@ -311,7 +313,7 @@ private_lane :git_push do |options|
|
||||
sh("git push https://#{api_token}@#{repo_url}")
|
||||
end
|
||||
|
||||
private_lane :config_xcodegen_alpha do
|
||||
lane :config_alpha do
|
||||
target_file_path = "../project.yml"
|
||||
data = YAML.load_file target_file_path
|
||||
data["include"].append({ "path" => "Variants/Alpha/alpha.yml" })
|
||||
@@ -321,7 +323,9 @@ private_lane :config_xcodegen_alpha do
|
||||
|
||||
version = ENV["GITHUB_PR_NUMBER"]
|
||||
|
||||
update_app_icon(caption_text: "PR #{version}", modulate: "100,100,200")
|
||||
Dir.chdir ".." do
|
||||
sh("swift run tools app-icon-banner Variants/Alpha/Resources/Alpha.xcassets/AlphaAppIcon.appiconset/AppIcon.png --banner-text 'PR #{version}'")
|
||||
end
|
||||
|
||||
bump_build_number()
|
||||
end
|
||||
@@ -371,26 +375,6 @@ private_lane :bump_build_number do
|
||||
increment_build_number(build_number: build_number)
|
||||
end
|
||||
|
||||
private_lane :update_app_icon do |options|
|
||||
caption_text = options[:caption_text]
|
||||
UI.user_error!("Invalid caption text.") unless !caption_text.to_s.empty?
|
||||
|
||||
modulate = options[:modulate]
|
||||
UI.user_error!("Invalid icon modulate parameters.") unless !modulate.to_s.empty?
|
||||
|
||||
Dir.glob("../ElementX/Resources/Assets.xcassets/AppIcon.appiconset/**/*.png") do |file_name|
|
||||
# Change the icons color
|
||||
sh("convert '#{file_name}' -modulate #{modulate} '#{file_name}'")
|
||||
|
||||
image_width = sh("identify -format %w '#{file_name}'")
|
||||
image_height = sh("identify -format %h '#{file_name}'").to_i
|
||||
caption_height = image_height / 5
|
||||
|
||||
# Add a label on top
|
||||
sh("convert -background '#0008' -fill white -gravity center -size '#{image_width}'x'#{caption_height}' caption:'#{caption_text}' '#{file_name}' +swap -gravity south -composite '#{file_name}'")
|
||||
end
|
||||
end
|
||||
|
||||
private_lane :create_simulator_if_necessary do |options|
|
||||
simulator_name = options[:name]
|
||||
UI.user_error!("Invalid simulator name") unless !simulator_name.to_s.empty?
|
||||
|
||||
Reference in New Issue
Block a user