Writing Your First GitHub Actions with Typescript

Writing Your First GitHub Actions with Typescript

I think I'll build an action that will deploy my database schema ... Looking a little closer, it seems that everything is written using TypeScript.

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](https://docs.npmjs.com/files/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:

  1. Compile into JavaScript code and add them to source control.

  1. Point action entry point to the compiled JavaScript code.

Step 3: Publish the Action

Publishing your action means making a release in your repository!

  1. Give it a version number (semantic versioning preferred.)

  2. Leave a short release description.

  1. Release and get a cup of coffee.

Step 4: Start Using the Action

  1. Add the released action to the workflow.

  1. watch the result and get another cup of coffee!

  1. This action lints documentation and generate reports:

Thank you for reading!

Typescript Github Actions JavaScript Programming

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Functional Programming: Using the Functor Type Class in TypeScript

Functional Programming: Exploring the Functor type class and its use cases

JavaScript Vs TypeScript

Get to know here difference between JavaScript & TypeScript, In this blog explained with pros and cons of TypeScript & JavaScript.

Have Your ML Models Built Automatically Using GitHub Actions

How to publish a custom GitHub Action on Marketplace for building Machine Learning Applications.

Deploy using Github Actions on AWS Elastic BeanStalk

In this article I’d be going through the process of deploying Node application on AWS Elastic BeanStalk using Github Actions.

Experiments with Javascript and Typescript

In this talk, I will give an in-depth introduction about Deno itself, how Deno deals with challenges differently from Node.js, and how Deno takes advantage of what is new in JavaScript and TypeScript. I will also discuss its internals, experiments, and how you can try it out or contribute to its development.