Git-updater: Add WP-CLI branch switching

Created on 13 Mar 2019  路  10Comments  路  Source: afragen/git-updater

This originated from a Slack conversation with @sc0ttkclark. It鈥檚 probably easier to contain the conversation here.

In thinking about how to engineer this solution it might be best to add to the class CLI_Integration with a couple of new commands plugin branch-switch-git and theme branch-switch-git with similar arguments as plugin install-git.

Install was easier as we already had that class. Update/Branch switch might be a little trickier. There鈥檚 no class currently for it. Perhaps use the URL for branch switching and send to a wp_remote_post? Not sure.

All 10 comments

@sc0ttkclark Just another thought. Do we even need this? We can push a branch switch using the REST API endpoint.

https://mysite.com/wp-json/github-updater/v1/update/?key=xxxxxxxxxxxx&plugin=<my-plugin-slug>&branch=<new-branch>&override=1

I believe the idea is still a good one to explore, if anything -- all it needs to do is call the same underlying code the REST API does.

Agreed. I look into it. Just not sure when.

+1 Would love to have this (in addition to a tag switching feature). I automate everything via the command line + SSH tools

Haven鈥檛 really looked at this yet but can do via REST API.

@sc0ttkclark @binaryfire I think I now have this worked out. Test on the develop branch.

wp plugin branch-switch <slug> <branch>

or

wp theme branch-switch <slug> <branch>

LMK how this works for you.

@afragen Working well so far! But it doesn't support tag switching right? Any chance of a wp plugin tag-switch command? Or would that be hard to implement?

@binaryfire have you tried using the command and entering a tag instead of a branch name?

I just tested with using a tag and it works. It does set the branch name as the tag and you are unlikely to _see_ any further updates, but it does work.

Released in v9.6.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dbeja picture dbeja  路  15Comments

NoWorries picture NoWorries  路  5Comments

tdavidrussell picture tdavidrussell  路  4Comments

hell-w-rld picture hell-w-rld  路  7Comments

jasonjersey picture jasonjersey  路  3Comments