You seem to want:
zip -jr customerlambda-356e9e4b8869b2cf7f483d739aa5a8aa34e0fc13.zip \
./bin/Release/net6.0/publish/
i.e. without -i
... With the -i
(include) option, you still haven't specified the path to the source file(s)/directory(ies) and hence the error:
zip error: Invalid command arguments (nothing to select from)
Notice one:
./bin/Release/net6.0/publish/
seems to be the relative path to where your source files/directories are, but adding -i
before it will turn it into an argument to the -i
option instead of an argument to the zip
command itself ... Therefore as far as the zip
command is concerned, there is no source file/directory argument ... and, you don't need to include that directory's contents with -i
as the -r
option will recurse through the contents of that directory so you dont need to use *
(which you better escape with a backslash \*
when used) either ... So simply remove -i
and *
.
Notice two:
The -j
option will result in zip
storing just the name(s) of a saved file(s) and not storing directory names(i.e. paths relative to the current directory) ... That might cause a problem when used with the -r
option as duplicate identical filenames might exist in sub-directories that will be recursed by the option -r
set which will result in zip
receiving repeated filenames to store in the archive which it cannot do and will result in an error like:
zip error: Invalid command arguments (cannot repeat names in zip file)
So, you might not want to use -j
in that case.
Notice three:
While relative paths in the form of ./subdir/subdir2/
and archive.zip
will work and be parsed relative to the current working directory, it might be a good idea in scriptfiles to use the full real path for both the output archive and the source directory(ies)/file(s) like for example if your source directory is:
/home/runner/work/PM2AWSCustomers/PM2AWSCustomers/bin/Release/net6.0/publish/
and you want the resulting archive file named to be customerlambda.zip
and saved in:
/home/runner/work/PM2AWSCustomers/
then use the zip
command like so:
zip -r /home/runner/work/PM2AWSCustomers/customerlambda.zip \
/home/runner/work/PM2AWSCustomers/PM2AWSCustomers/bin/Release/net6.0/publish/
the backslash \
is used to escape the newline used for redability purposes in this post and will make the shell read the command as one liner ignoring the escaped newline.