Running fastlane build_and_rename
on the following Fastfile
,
lane :build_and_rename do
sigh
gym(output_directory: "./Build/")
sh "mv ./Build/MY-APP.ipa ./Build/nicely_name.ipa"
end
results in the following error ln: ./Build/MY-APP.ipa: No such file or directory
.
Testing shows that FastLane's sh
action runs in the ./fastlane
directory. Example, fastlane test_sh
for the following Fastfile
lane :test_sh do
sh "touch where_am_i.txt"
end
results in a where_am_i.txt
created in the ./fastlane
folder. Not in the folder where fastlane
was run.
Obviously I could change all scripts to include ../
but wondering if there was a way to make fastlane
run sh
action in xCode's root project?
It turns out to be rather simple, just add cd.. &&
to change to the root directory.
lane :test_sh do
sh "cd .. && touch where_am_i.txt"
end
https://github.com/fastlane/fastlane/issues/990#issuecomment
To change the directory you can use Ruby, Dir.chdir
Example
lane :test_sh do
Dir.chdir("..") do
# code here runs in the parent directory
sh "touch where_am_i.txt"
end
end
See Fastlane docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With