Sitemap
Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

The Magic of GitHub Actions

5 min readJun 10, 2024

--

Press enter or click to view image in full size
Image source: Unsplash

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.

--

--

Clyde D'Souza
Clyde D'Souza

Written by Clyde D'Souza⁠

I'm now writing on my personal blog. You can read the latest stories here - http://blog.clydedsouza.net/