Tracking: Install themes and plugins directly from Git
adamziel opened this issue · 6 comments
Let's support installing plugins and themes directly from git, e.g.:
- Query API:
- GitHub repo:
https://playground.wordpress.net/?plugin=https://github.com/dmsnell/blocky-formats - GitLab repo:
https://playground.wordpress.net/?plugin=https://gitlab.com/dmsnell/blocky-formats - Arbitrary git repo URL:
git@github.com:dmsnell/blocky-formats.git
- GitHub repo:
- Blueprints API:
- Resource shorthand:
{ "plugins": ["https://github.com/dmsnell/blocky-formats"] } - A full resource definition:
{ "plugins": [ {"resource": "git", "url": "git@github.com:dmsnell/blocky-formats.git" } ] }
- Resource shorthand:
A few other features that would be useful to support
- Subdirectories:
https://github.com/WordPress/playground-tools/tree/trunk/packages/wordpress-playground-block - Branches:
https://github.com/WordPress/playground-tools/tree/my-sub-branch/packages/wordpress-playground-block - PRs:
https://github.com/WordPress/playground-tools/pulls/1
We'll likely need to recognize the git service provider domain, and rewrite the provider-specific URL into a CORS proxied git URL behind the scenes.
CI artifacts are out of scope of this issue: https://github.com/WordPress/gutenberg/actions/runs/10575588549/artifacts/1858796776
Pre-requisites
Follow-up work
Once this is in place, let's:
- Update all the Blueprints in the community space to use direct checkout
- Rewrite github-proxy.com references into direct checkout for any Blueprints we cannot go back and update
Once we have a good git -> Playground flow, let's look into #1709 to enable providing default configuration in the repo.
@adamziel I see that there were some new docs added to the Playground docs today, and this caught my eye
I was not aware that it was possible to do it this way, and if it also works in the Playground block, it would solve my immediate need for Learn.WordPress.org usage. So if I test it and it works, I'm wondering if this work is still needed?
Potentially a Public PHP CORS Proxy will be useful for other potential issues in plugins that call APIs that don't have CORS support. We already encountered this with the [WildApricot API](https://forums.wildapricot.com/forums/309658-developers/suggestions/9958881-api-implement-cors-for-cross-domain-api-requests)
This can be marked as solved as soon as we deploy the PHP CORS proxy (#1467 cc @brandonpayton).
The git parts are provided by #1858 and #1860. The following Blueprint would install the blocky formats plugin:
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"login": true,
"landingPage": "/wp-admin/",
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "git:directory",
"url": "https://github.com/dmsnell/blocky-formats.git",
"ref": "trunk",
"path": "/"
}
}
]
}Note there is no Query API counterpart and there is no shorthand syntax such as {"plugins":["https://github.com/dmsnell/blocky-formats.git"]}. You need to explicitly type out the entire resource definition. I didn't find any developer-friendly, useful, and generalizable way of encoding the URL, ref, and path as a string. If you can think of one, let's discuss in #1793.