CICD

Deploy a Go Project to Docker hub by Github Action

In this article, we will create a simple golang application CI/CD process and push it to Docker hub by github action. Finally, will illustrate an example of how to use the terraform and docker-compose to deploy a local docker environment.

Create Docker hub repository

First, create a repository on Docker hub, here we create a repo name adon988/go-github-action-helloworld

Generate Github Actions workflow

Create a project folder .github/workflows/ and add github actions yaml file

Continue Reading

Github Action Auto Ssh to Host and Execute Script

Github action use SSH to access remote host and execute a script

In this article, we will use 6 steps to illustrate how to use Github action to access a remote server and execute the shell script. So that’s getting started:

step 1. Generate keygen in local machine

In your local machine, execute the following command in the terminal and generate your ssh-keygen.

ssh-keygen -f ~/.ssh/yourhost -t ed25519 -b 4096 -C "youremail@example.com"

step 2. Copy our public key to the remote server’s authorize

# goto remote server

echo "your public keygen content" >> .ssh/authorized_keys

step 3. copy our Private Key and paste it into Github Secrets.

Go to “Settings” > “Secrets”, and click “New repository secret” button.

Continue Reading