Skip to content
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

Support for subdirectories #716

Closed
jhotadhari opened this issue Sep 18, 2018 · 5 comments
Closed

Support for subdirectories #716

jhotadhari opened this issue Sep 18, 2018 · 5 comments

Comments

@jhotadhari
Copy link

Hi,
does the updater work for plugins inside a repository subdirectory?

Why? My plugin repository is structured in source and distribution subdirectories.
For Example (I know GitHub Plugin URI declaration still missing):

This is not really an issue. Hope this is the right place for my question.

Thank you. If it works for my structure, I'll use it for all my projects.

@afragen
Copy link
Owner

afragen commented Sep 18, 2018

GHU wasn’t designed to use GitHub subdirectories. Much of the reason is how GitHub functions as GHU uses its native downloading the repository’s zip file. Much of the requirement means that the plugin’s base file be available in the root directory of the repo.

If your plugin uses a build command you can use the release asset to add it to your GitHub repository’s release and GHU will use that for updating, but the root directory of your repo must contain a dummy main plugin file that is named identically to your main plugin file. This dummy file must have the updated version number as this is the file that GHU query’s for updates.

https://github.com/afragen/github-updater/wiki/Settings#release-assets

@afragen afragen closed this as completed Sep 24, 2018
jhotadhari pushed a commit to jhotadhari/carousel-grid-blocks that referenced this issue Dec 17, 2018
Added support for GitHub Updater Plugin

Using release assets. See afragen/git-updater#716
@jhotadhari
Copy link
Author

Hi, thanks for your fast reply. And sorry for my late reply, didn't find time.

I tried your solution with this plugin: https://github.com/jhotadhari/labeled-list-block
Added GitHub Plugin URI and Release Asset to the main plugin file.
Added a dummy main plugin file with same header and file name to the repository root.
Published a new release with title 0.1.2 and a release asset labeled-list-block-0.1.2.zip.

Installed GHU and added personal access token.
(manually added the two required lines to the header of installed labeled-list-block plugin so GHU checks for updates. And manually decreased the version number).
Now I can see, that a new update is available.

When updating, I get the positive green update-message notice that says: Labeled List Block updated!
But the wp-content/plugins/labeled-list-block/ directory is empty afterwards.

debug.log:
[17-Dec-2018 14:44:13 UTC] PHP Warning: copy(): The first argument to copy() function cannot be a directory in /htdocs/wp-admin/includes/class-wp-filesystem-direct.php on line 243
[17-Dec-2018 14:44:13 UTC] PHP Warning: array_keys() expects parameter 1 to be array, boolean given in /htdocs/wp-admin/includes/class-wp-upgrader.php on line 510

Made another test and manually decreased the version number of the installed GHU plugin.
Update is available and updating successful. No errors, no warnings.

Do you have any suggestions?
Can you tell me another plugin that uses GHU and release assets? So I can test with this plugin?

Thanks a lot. Will reply faster this time ;)

WordPress Version 5.0.1
GitHub Updater Version 8.5.2
PHP Version 7.2.9

@afragen
Copy link
Owner

afragen commented Dec 17, 2018

The problem here is your release asset zip. It should have the following structure.

labeled-list-block-x.x.x.zip
   |
   labeled-list-block
     |
     labeled-list-block.php
     src
     ...

In other words the zipfile should unzip to a containing folder with the appropriate plugin slug and all plugin files go in that folder.

This is a WP Core thing.

@afragen afragen reopened this Dec 17, 2018
@afragen
Copy link
Owner

afragen commented Dec 17, 2018

https://github.com/cedaro/satispress also uses release assets.

jhotadhari pushed a commit to jhotadhari/labeled-list-block that referenced this issue Dec 18, 2018
Fixed support for GitHub Updater Plugin with release assets

Changed structure of release asset zip. Unzips to a containing folder with the appropriate plugin slug and all plugin files. See afragen/git-updater#716
@jhotadhari
Copy link
Author

Thanks a lot,
to restructure the release assets zip solved the problem.
Now it's working great!

jhotadhari pushed a commit to jhotadhari/carousel-grid-blocks that referenced this issue Dec 18, 2018
Fixed support for GitHub Updater Plugin with release assets

Changed structure of release asset zip. Unzips to a containing folder with the appropriate plugin slug and all plugin files. See afragen/git-updater#716
@afragen afragen closed this as completed Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants