Thanks for your reply. I found my mistaken. The special thing is that I should run the zip command in the project directory instead of in the parent directory. I didn't realise that until I saw you code. And everything works well now, thanks.
I have a workflow which is cloned from github. I want to package the workflow using shell command instead of "export" in the preferences panel. I've tried zip and tar to archive the code but it doesn't work. What is strange is that I can extract the normal .alfredworkflow files if I change their file type to .zip or .tar. So is there any way to archive the workflow using command?