Generating a transport package/extras repo with GitHub actions

Maybe this is a bit pie in the sky, but my team and I have a collection of snippets that we use on 95% of the sites we work on and I would love for them to be installable rather than the current “Create Snippet → Paste Code From Internal Documentation → Save Snippet” flow that we are using.

Even more ideal would be if we could use the repo url to add the package from the extras tab, but I know even less about how that works than I do transport packages. Interested to hear what y’all think!

The extra packman exists which allows you to pack a selection of templates, TVs, chunks, snippets and plugins into a single ZIP package. You can then just drag this ZIP into your package manager to install all of the components.

The version currently in the extras downloader does not work with MODX 3 - however - @halftrainedharry created an alpha version which works well. You can download it here.

Just drag that ZIP file into your site’s package manager and install it.

You can read a bit more on this here.

Hopefully this extra will be updated soon.

1 Like

PackMan is the easiest solution to create a transport package. But it only runs in the MODX manager.


If you rather want to manage your “collection of snippets” in Git, then maybe have a look at GPM. This is the tool that is used for most MODX extras nowadays. But the setup and handling is more complicated than PackMan. I created a couple of videos on Youtube about the usage on Windows.

1 Like

GPM runs only inside of MODX, too. Building transport packages needs a MODX installation.

Sure, you also need a MODX installation for GPM.

What I meant to say is that with PackMan you have to (manually) create all the snippets inside the manager of a MODX installation before you can create the package. And every time the code of a snippet changes, you have to make this change in the MODX manager.

I just want to make sure that there is currently no option to generate transport packages with GitHub actions because of this limitation.

2 Likes

Maybe you can use gitify for this? I have a repo for all my snippets and stuff. Have a look here: GitHub - jenswittmann/MODX-Gitify-Preset: Preset for a clean MODX Installation with Gitify. A good start for CurlyFramework.

MyComponent would do it, but it’s kind of overkill for your use case. If Packman works for you, it’s a much better option. The only advantage of MyComponent for you is that it’s easier to update the package if you need to add or remove snippets.

This is off the top of my head, so it may not be entirely accurate:

Using MyComponent, you should be able to start a new project in the UI and switch to it. That will create your project with the example config file (which will be loaded with stuff you don’t need). Then, edit your project’s config file under core/components/mycomponent._build/config/yourproject.config.php. Delete all the objects in the config file except snippets, and edit the snippet section to list your snippets. Then reduce the process array to just snippets.

In the MyComponent UI (just view the MyComponent resource), run Bootstrap, Export objects, then Build.

I’d strongly advise you to edit the config file in a good code editor, because it has to be valid PHP and it’s easy to delete a curly brace when doing a lot of deletes.