Search code examples
continuous-integrationcontinuous-deploymentgithub-actionsnpm-package

Best method of listening to NPM publishing status via GitHub Actions


I have a Lerna mono-repository which runs lerna publish across 23 packages, some private and some public. The GitHub Release/Tag events happen before NPM Publish is completed and so I can't listen to GitHub release events.

Instead, I'm looking for the best method for GitHub Actions to listen to an NPM Publish status so that upon successful completion I can run an additional script to bundle packages for deployment to CDN.

Guidance here would be much appreciated.

Thanks,


Solution

  • Turns out Git tags/release wasn't that practical because they happen prior to publishing. So, if publishing fails we could inadvertently release. The best way to retrieve the version is with npm view package-name version spawned from a child_process if using node.

    After much thought, there turned out to be a much straight-forward solution, use UNPKG which automatically deploys to the CDN in sequence with the NPM Publish task automatically. I have to do nothing except run the publish command already in use and documentation for ur consumers. This also, eliminates CDN support and maintenance requirements to host our won scripts, thus reducing costs.