Member-only story
The Magic of GitHub Actions
Publishing the same code base to two different npm registries
Introduction
If you’re developing an npm package, you might want to publish the same piece of code to multiple npm registries to potentially cater to a broader audience. Let’s say we decide to publish our npm package to npm js and GitHub. Although this may seem straightforward, it has one little quirk we need to get around. Let’s take a look!
This article also lives on my personal blog. You can read the original version here for free.
Getting the GitHub Action ready
We have our npm package in this GitHub repository so naturally we’ll be using GitHub Actions to build and publish our npm package. You can view the entire workflow file here, but let me break it down for you in this article.
Building the npm package
The steps outlined in the code snippet below are responsible for checking out the code from the repository, installing the dependencies, running the required tools to ensure consistency in coding standards, running unit tests to ensure new changes don’t break the project, and finally building the project to compile TypeScript into the JavaScript output.










