Setup CI-CD with github action in 1 note

Tram Ho

Previously to store the code of personal projects I used to use gitlab, then bitbucket because there were free private projects, but since github was acquired by Microsoft and free private projects, after a period of continuous error after free time github is quite ok so I have gradually moved the private projects to github. And one of the needs when using git, of course it is CI-CD. When working as a company, most of the CI-CDs were devops and system team setup and usually the companies I worked with also used gitlab or jenkins. Just focus on code, push up every CI-CD step that is already set up. Recently, there are a few individual projects that are quite lazy to build by hand and then push to the server so they wanted to setup CI-CD to facilitate deploying and testing, the need is quite basic to push the code, build java for the server and reactjs for The client then copies the build file to the VPS already installed in the environment. The needs are simple, so steps is quite simple. Let’s take a look at a few main steps:

First is the reactjs client part

Config in the yml file is also nothing complicated, here at the last step I use the action garygrossgarten / github-action-scp to copy the build file to vps, the sensitive information I use env in the github project secrets, you have can be defined at / settings / secrets

Similar to the server part of java

Action jacobtomlinson / gha-find-replace is used to replace a phrase with the value passed in the specified file. The step is simple but the results are very good, saving a lot of deploying and testing time😄

Share the news now

Source : Viblo