Better Programming

Advice for programmers.

Follow publication

Build GitHub Actions with Typescript

They’re fast and they run everywhere

Jackson MZ
Better Programming
Published in
3 min readDec 12, 2019
Photo by Ruca Souza from Pexels

GitHub Actions is a CI/CD platform

GitHub Actions (as for other CI/CD services/platforms):

  • Triggers on events
  • Prepare environment(s)
  • Runs workflow(s)
  • Report results

A GitHub Action can either be a Dockerfile or Javascript

In a Dockerfile action:

  • The environment is defined by container layers
  • The workflow is defined by entry point bash script

In a JavaScript action:

  • The environment is defined in the package.json, as NPM modules
  • The workflow is defined by the JavaScript/TypeScript code

JavaScript actions are faster and more stable

The strength of JavaScript actions, compared with Dockerfile actions, are:

  • The familiar syntax for most web/mobile/back end developers
  • Runs everywhere (JavaScript is less restrictive than Docker)
  • Runs faster by skipping container building and VM warm-ups.

Note: Let’s treat ourselves better and use TypeScript instead of JavaScript!

Step 1: Configure the Action

The configuration will let GitHub know how to run the action and how to list it on the GitHub marketplace.

The configuration is defined with a yaml file, action.yml, that contains:

  • The name of the action
  • The arguments to the action
  • The entry point to run the action
credit: example GitHub Actions configuration from readable-readme

Step 2: Implement the Microservices

  1. write source code for your magical action:

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Jackson MZ
Jackson MZ

Written by Jackson MZ

Research Engineer (LLM Inference)

Responses (2)

Write a response