-
Notifications
You must be signed in to change notification settings - Fork 109
Always include slug directory in zip #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I need to basically emergency release a 2.0 to deal with a Debian image failure that means we will have something much faster moving forward anyway, so I'm sorry this will miss that release but I would like to get another one done within the next few weeks. Could you possibly refresh this and rework it to not move the |
|
Hi @helen! Sure, happy to refresh this. You mention not moving the |
|
@JasonTheAdams Good question - renaming |
|
So I needed to do this in a different action, and the |
|
Sorry, can you provide more context? I'm not sure what command you're referring to that supports the |
|
Ah 🤦♀️ that's my fault, I forgot I was dealing with |
|
My only concern with a symlink is that I'm not sure how zip would handle it on different OS's. Since this is now a composite action, we want to be a simple as possible to avoid edge cases. Rename, zip, rename back is boring but (I think) reliable. Aiming to refresh this in the next couple days, FYI. |
|
It's already a little bit risky as a composite action with |
|
Thanks, Helen! Honestly, I've never tried zipping up a symlink. Sounds like black magic. That said, I just tested out zipping up a symlink, giving the resulting file a different name than the symlink, and sure enough when I unpacked it the resulting folder had the symlink name. 🤯 So when I'll go with that! Thanks for teaching me something new! |
|
@helen I just refreshed this. 🎉 I see in the Checklist an item for adding tests. I can't see where or how to add tests. Mind pointing me in the right direction? Also, I suggest squashing this when all is said and done. |
|
Nice! There aren't any real tests besides Shellcheck for linting right now, I just approved it to run and you'll see that it's telling you to wrap something in quotes (I think one of the usages of I'll be taking a look at various things in the next few weeks or so to see what I want to wrap up in a new release, there's a lot of outstanding stuff around custom workspace/accommodating things like Composer better, so I want to make sure I at least know what can be done now or not. It may take me a bit simply because I have a particularly busy few weeks ahead and don't have anybody else working on maintenance here right now, just know that I very much appreciate the tip and your work here! |
|
Just added the double-quotes around No rush on this. I'm happy to have it added at your leisure. It's not causing us any problems. 😃 |
dinhtungdu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update looks good to me. Good to learn about zipping symlink 🤯
The latest commit contains left over command.
|
@iamdharmesh bumping back up for your review. |
iamdharmesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @JasonTheAdams. LGTM! 🚀
@dkotter I have made some minor changes in the existing PR. So, I requested a quick review from you.
Thanks.
Description of the Change
When zipping a file, the zip command can zip the files with no path, a relative path, or an absolute path:
my-plugin.phpzip my-plugin.zip .my-plugin/my-plugin.phpzip my-plugin.zip my-plugin//path/to/my-plugin/my-plugin.phpzip my-plugin.zip /path/to/my-pluginWhen unzipping, the path type comes into effect. No Path uses the zip file name as the directory to put the files in, or it unloads into the current directory. Relative creates a new directory with the relative structure. Absolute attempts to unload to the absolute position.
WordPress itself has a limitation when retrieving zip files from remote servers for plugin updates wherein the zip file must be in the Relative Path format. The other two will break.
This PR changes from a No Path zip to a Relative Path zip, with the plugin slug being the relative directory.
Alternate Designs
Presently, the No Path method is used when zipping. The alternatives are as outlined above: Relative and Absolute.
Benefits
When folks use the Plugins > Add New > Upload feature, if the zip files have No Path, then it assumes the zip name to be the directory for the files. The same is true when unzipping in the OS. So if a user downloads the zip, has a zip in the folder already with that name (which renames it to something like plugin.zip(1)), and then installs it, it will be installed to the plugin1 directory. By using a Relative Path, it's ensured that the directory will always reflect the plugin slug.
Possible Drawbacks
No drawbacks that I can think of. The zip file will work more intuitively.
Verification Process
We dealt with this over at GiveWP and had to wrestle this weird issue down. Our scripts now all use a Relative Path. We used this action for deployment and I noticed it's using No Path, so I thought I'd hop over and help! We've generated the zip using all the methods and tested them via upload install into WordPress.
Checklist:
Applicable Issues
Changelog Entry
Changed