Skip to content

Private Packagist

RobLoweMOJ edited this page Apr 3, 2024 · 10 revisions

If you look at the composer file you will all in house custom theme and plugins are pulled into the docker image by composer from private packagist

Adding a new package to private packgist

Setup your github repo

Make sure your new github repo has a composer.json defining the package

For example

{
    "name": "ministryofjustice/example-plugin",
    "description": "Example Plugin",
    "type": "wordpress-plugin",
    "require": {}
}

The options for type are:

wordpress-plugin - standard wordpress plugin wordpress-muplugin - required plugin thats mu-plugins folder wordpress-theme - wordpress theme installed into themes folder

Add Package to Private Packagist

Login to private packagist.

Add package

Click 'Add Package' button. Select by URL.

Fill in new package form

Add the github repo url to the Repository URL field. Then click the create button.

Access subrepo

You then need to go into the Hale Platform subrepo and add this package

While in the subrepo click add package then Organization Packages

Add selected package to subrepo

Select the package and press the 'Add selected packages' button

Setup Webhook

When a package is changed in github we need these changes to be pushed to private packagist for example we need latest release of a plugin in packagist.

Github communicates with private packagist by a web hook but this needs to be setuo.

If you go into the main info page (within private packagist) about the package you have just added you should see the following message where a url will replace [web-hook-url].

This package doesn't support the automatic setup of webhooks. Set up a hook doing a POST request to [web-hook-url]

Copy this url as you will need this to setup the webhook in github.

github settings webhooks

Go the settings then webhooks in your package's github repo. Click the add webhook button.

Webhook setup

Add your [web-hook-url] to the payload url field. Leave the 'content type' and secret as default

On "Which events would you like to trigger this webhook?". Select 'Let me select individual events'.

Then select the following events

  • Branch or tag creation
  • Branch or tag deletion
  • Pushes
  • Releases
  • Repositories

Make sure the active box is ticked and click the 'Add webhook' button.