Skip to content

Commit d1c461c

Browse files
committed
rework lane matchesque to be DRYer and to export KEYSTORE_FILE
1 parent 23e63c3 commit d1c461c

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

fastlane/platforms/android.rb

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,25 @@
7878
lane :matchesque do
7979
match_dir = clone_match
8080

81-
# don't forget --- lanes run inside of ./fastlane
82-
gradle_file = 'signing.properties'
83-
keystore_name = 'my-release-key.keystore'
84-
play_store_key = 'play-private-key.json'
85-
81+
# we'll be copying files out of the tempdir from the git-clone operation
8682
src = "#{match_dir}/android"
87-
88-
# FastlaneCore::CommandExecutor.execute(command: "pwd", print_all: true, print_command: true)
89-
UI.command "cp #{src}/#{gradle_file} ../android/app/#{gradle_file}"
90-
FileUtils.cp("#{src}/#{gradle_file}", "../android/app/#{gradle_file}")
91-
UI.command "cp #{src}/#{keystore_name} ../android/app/#{keystore_name}"
92-
FileUtils.cp("#{src}/#{keystore_name}", "../android/app/#{keystore_name}")
93-
UI.command "cp #{src}/#{play_store_key} ../fastlane/#{play_store_key}"
94-
FileUtils.cp("#{src}/#{play_store_key}", "../fastlane/#{play_store_key}")
83+
# don't forget: lanes run inside of ./fastlane, so we go up a level for our basedir
84+
dest = File.expand_path('..', '.')
85+
86+
# we export this variable so that Gradle knows where to find the .properties file
87+
signing_props_dest = "#{dest}/android/app/signing.properties"
88+
ENV['KEYSTORE_FILE'] = signing_props_dest
89+
90+
pairs = [
91+
{:from => "#{src}/signing.properties", :to => signing_props_dest},
92+
{:from => "#{src}/my-release-key.keystore", :to => "#{dest}/android/app/my-release-key.keystore"},
93+
{:from => "#{src}/play-private-key.json", :to => "#{dest}/fastlane/play-private-key.json"},
94+
]
95+
96+
pairs.each do |pair|
97+
UI.command "cp #{pair[:from]} #{pair[:to]}"
98+
FileUtils.cp(pair[:from], pair[:to])
99+
end
95100

96101
remove_match_clone(dir: match_dir)
97102
end

0 commit comments

Comments
 (0)