-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Sync examples to glitch #5222
Comments
Can glitchclub pull from a git directory? |
Sorry, I overlooked that point. I don't immediately see how to adapt the glitchub implementation to handle sub-directories. I'm wondering about another solution where we:
Techniques for doing this documented here:
Once we have a separate zero-overhead git repo for each example, we can either use glitchhub, or (even simpler) just provide a glitch.new URL using the per-example repos. I'm going to try prototyping the techniques for mirroing a sub-directory into a separate repo, to see if I can make that work. |
I've got a working proof-of-concept of this. A couple of "examples" are mastered in this repo: E.g. https://github.com/diarmidmackenzie/split-sub-directory/tree/main/examples/example1 GitHub Actions mirror all changes here: And you can use this URL to spin up a glitch of the example: @dmarcos - can you take a look & let me know if you'd be happy for me to replicate the setup for A-Frame? Will need some access to set up new repos (one for each example we want to mirror), deploy keys & secrets. Have a read through here & see if you are happy with the detail. If you want to test this out, happy to add you as a collaborator on https://github.com/diarmidmackenzie/split-sub-directory (so you can make comits & observe them replicating to the mirror repos). |
wow. thanks for the investigation. I would prefer not going down the route where each example is its own repo. It sounds complicated to maintain and confusing. |
An alternative idea. Have a script in the A-Frame repo that updates all glitches associated to the examples with a single command. e.g |
I've had a look into whether this is possible. All the existing examples we have for GH->Glitch sync synchronize a whole repo. However I've looked more closely at glitchub (and other similar techniques documented here, here and here), and it should in fact be possible to just pull a sub-directory. They all operate in more-or-less the same way:
All that's needed is to modify this script to just pull a sub-directory, rather than the whole git repo. That can be done by cloning the whole thing + pruning (as I did above), or perhaps using this tool, which probably does the job more efficiently (using the The relevant sripts can be found:
I'm not convinced this is a cleaner / more easily maintained solution. It's much more tightly coupled to Glitch than the solution I'd suggested above (which leverages glitch.new such that there wouldn't even need to be an A-Frame account on Glitch). But I think it can be done, and happy to look at another round of prototyping to do it this way. |
So in a glitch terminal, the following will copy over a sub-tree of a GitHub repo
Or for an A-Frame example:
Should be possible to trigger that script via a GitHub webhook. The other thing we need to do is to update the A-Frame script location from:
to
but without hard-coding the version string into the scripts on glitch (or we'd have to update them every release!) Here's a script that can do just that, extracting the version string from package.json.
|
I have a working version of this now, built on the glitchub WebHooks solution. This Glitch: I have a webhook set up on this test repo: Whenever I commit to this repo, the glitch example refreshes itself from the latest aincraft example. We could easily build out more glitches like this & set up webhooks to update them from the main A-Frame repo. Setup is just 1 webhook per-glitch, which is pretty simple to configure. One thing I don't much like about this solution is that it requires a bunch of code inside the Glitch itself that is unrelated to the example - see Whereas the alternative solution using a repo per-example & glitch.new just presents the user with the code for the example & nothing else. Having tried out both solutions, my recommendation would still be to go for the mirrored repos (first suggestion) In terms of reservations expressed about that first approach:
|
Not too familiar with Glitch, but it seems it's possible to push to a Glitch (https://glitch.happyfox.com/kb/article/85-pushing-local-code-to-a-project/). So wouldn't it be an option to store the corresponding git remote urls as secrets and use a GitHub Action to (force) push the updated version? |
Description:
Historically, we hosted various A-Frame examples on glitch, and linked to them from the docs.
Over time, they became outdated, as there was no per-release process to update them (and if there had been it would have been tedious and manual).
We have now moved the master code for these examples into GitHub at examples\docs*, where they can be tested on a per-release basis & easily maintained.
What's now missing is the ability for a user to easily try out modifications to the code, as they could with glitch.
Discussion
Discussion of various options took place here
Conclusions:
1 - we'd like to stay on glitch as users are familar with it
2 - we'd like code in examples\docs to use a local A-Frame library (rather than a CDN one) because it makes testing a lot easier.
3 - we'd like a solution with zero additional maintenance, where just updating stuff in GitHub results in updates to the glitches.
This points to a soluton comprising:
Rejected solutions:
Implementation
Will require access to the A-Frame glitch account. @dmarcos, do you have this? Are you happy to share it, or do you want to do the glitch-side setup yourself?
The text was updated successfully, but these errors were encountered: