How to automatically build for JavaScript and publish to a release on GitHub

GitHub Actions are a recent addition to GitHub which allow you to do a lot of CI (Continuous Integration) work directly on GitHub, without having to go through the effort of setting up a CI system like Travis CI, CircleCI or Drone (which is what we mainly use at my workplace, City Pantry).

Using GitHub Actions, you can automatically create builds, run tests, and even deploy, using a (relatively) simple YAML syntax. As a private developer on the free plan, you get 2000 Action minutes per month, which should be plenty to give them a try — and if your repository is public, you get unlimited minutes!

I had a project which was written in TypeScript, but it needed to be consumed by Node-RED, which requires compiled JavaScript bundles. It’s easy enough to point Node-RED at a GitHub repository as a package source and it will work things out using the configuriation in package.json; but I didn’t want to have to commit compiled code to the repository.

Actions to the rescue! In this post, we will walk through how to automatically compile and package a TypeScript project, and attach the compiled tar file to the release, so it can be downloaded from a URL like https://github.com/paullessing/proj/releases/download/v1.0.0/package.tgz

#typescript #npm #javascript #github #developer

Publishing TypeScript Packages with GitHub Actions
8.20 GEEK