You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 'zip' action does not behave as expected when given specific files to zip.
This was previously reported by another reporter at #20219 but they did not follow up.
Command executed
In ProjectName/fastlane/Fastfile:
default_platform(:android)
platform :android do
lane :quickFastlaneTest do
zipList = ["x.txt", "y.txt"]
zip(
path: ".",
output_path: "test.zip",
include: zipList
)
end
end
Then, from ProjectName, run this command sequence:
[✔] 🚀
[10:44:32]: ------------------------------
[10:44:32]: --- Step: default_platform ---
[10:44:32]: ------------------------------
[10:44:32]: Driving the lane 'android quickFastlaneTest' 🚀
[10:44:32]: -----------------
[10:44:32]: --- Step: zip ---
[10:44:32]: -----------------
[10:44:32]: Compressing ....
[10:44:32]: $ zip -r /Users/pridhr01/StudioProjects/ProjectName/test.zip . -i ./ProjectName/x.txt ./ProjectName/y.txt
[10:44:46]: ▸ Scanning files ..
[10:44:46]: ▸ zip warning: name not matched: [redacted]
[10:44:47]: ▸ . adding: ProjectName/x.txt (stored 0%)
[10:44:47]: ▸ . adding: ProjectName/y.txt (stored 0%)
[10:44:47]: Successfully generated zip file at path '/Users/Username/ProjectName/test.zip'
To be clear, I should not have to do this. If it was absolutely necessary, then I would expect the output file to need the same approach. This current behaviour is confusing.
For the time being, my preferred workaround is to use sh instead of this action:
zipList = ["x.txt", "y.txt"]
Dir.chdir("..") do
sh("zip", "-r", "test.zip", *zipList) #unpack array into varargs
end
So in your example the Zip command is run in the directory /Users/Username, which is why it can't find the text files. You can prove this by chdir'ing to your project directory and executing the command that Fastlane prints out: zip -r /Users/Username/ProjectName/test.zip . -i ./x.txt ./y.txt
This caused a big headache for me when I switched to Fastlane because I needed this exact functionality, so I just ended up writing my own zip action with code changed to create the archive without moving up one directory.
New Issue Checklist
Issue Description
The 'zip' action does not behave as expected when given specific files to zip.
This was previously reported by another reporter at #20219 but they did not follow up.
Command executed
In
ProjectName/fastlane/Fastfile
:Then, from
ProjectName
, run this command sequence:pwd
outputs/Users/Username/ProjectName
Partially redacted Fastlane output is:
Expected result: The zip file contains x.txt and y.txt.
Actual result: The zip file is created but empty. The command takes a long time to execute and warnings indicate it's operating at the wrong level.
Correcting for this prediction, if I alter the include path to include the project name:
then this works:
To be clear, I should not have to do this. If it was absolutely necessary, then I would expect the output file to need the same approach. This current behaviour is confusing.
For the time being, my preferred workaround is to use
sh
instead of this action:Environment
The text was updated successfully, but these errors were encountered: