GitHub Action: Auto Deployment Concepts

GitHub Action: Auto Deployment Concepts

Saamraata Dhanaananda's spy, Laghurudra from Nepal, has arrived at Paataliputra.

  • Chanakya Series, Episode 36.

Nowadays, Clearly, a trend seen is the migration to GitHub actions from XYZs, because of Github's friendliness and ease of use, and other solid factors.

One of the usages of Github action is the Deployment to development/staging/production server once code is merged to the master/main branch ie, Auto Deployment.

SSH Login:

SSH login is commonly used to log in to the remote server.

When we manually do ssh login, syntax goes like this:

ssh -i {path/to/private/key} {username}@{ip_address}

breakdown:

  • path/to/private/key: path of a ssh-keygen generated private key (in local system).
  • username: username of one of the users, from Remote server(compute system).
  • ip_address: External IP address of the Remote Server.

In order to achieve login, the local system's public key must be added to VM (in case of Google Cloud) ssh keys, so that the local system is identified.

GitHub action:

The same above action shall be repeated in GitHub in terms of code.

Various customizable actions from guys such as appleboy, garygrossgorten etc make the process simplified enough and convenient.

P.S: Do not push the credentials in code but store in GitHub secrets.

  1. [ssh-action] (github.com/appleboy/ssh-action)
  2. [github-action-ssh] (github.com/garygrossgarten/github-action-ssh)
  3. GitHub Secrets