phpcomposer-phpgithub-actionspackagist

Make packagist require github artifact (instead of commit)


I'm using packagist.org to publish some custom php packages in order to be installable (or rather required) via composer, but I have this some packages that require some build steps (for compiling CSS/JS).

The build process is done via github actions, on every tag release, and it spits a zip file. Like it is here: https://github.com/iamntz/carbon-fields-urlpicker/releases/latest

The goal here would be to have users to run composer require iamntz/carbon-fields-urlpicker and use the carbon-fields-urlpicker.zip within the release, not the git tag of that release.

Note that I'm aware of using composer by requiring the full URL of a zip. That's not what I'm looking, as it makes the installation process more cumbersome than it should.

I know that CSS/JS shouldn't sit into a php package, but it is what it is. If this changes anything, let's say we need to replace something on the PHP code before release.


Solution

  • It seems that you can actually specify the ... dist key into your composer file and packagist will just pick up that instead!

    You can see it here how it works:

    https://github.com/iamntz/carbon-fields-urlpicker/blob/0d5014d078dc797af33829c9ad1aee2ae4074fd4/composer.json#L9