preface

I was trying to make a video, but it took me a whole day to record it, and it was full of bugs, so I’ll just write the article.

Let’s talk about what this tool solves.

Github WebHook allows you to automatically compile/deploy git push commands when you set them locally, saving you uploading time.

clone

Project Address:

https://github.com/houxinlin/CoolDeploy
Copy the code

Clone it first. Since it is a Gradle project, the package command is./gradlew bootJar.

The default port is 5993 and the default password is Cooldeploy.

configuration

The first thing to do is generate the public key, which is needed when the system pulls your project, and then copy the public key to your Github, which is a necessary step.

Add the project

Here take my blog as an example, click the home page to add, enter your project path, note only SSH path.

After clicking load, it will be asynchronously loaded in the background, and the result will be notified to you through WebSocket.

Add build/deploy commands

Vue projects are packaged in two steps, packaged with the NPM build command, and then copied to the nginx directory.

Shell scripts perform the last steps, such as copying, where you can use {Project_Home} to represent the root path of your project.

Increase the WebHook

Go to your project’s WebHook Settings and enter the push path. The push path is the address of the system + WebHook /.

After setting. When you locally push, Github will push specific information to our system, and our system will automatically execute according to the compilation command you set.

test

Let’s say my Blog says Blog in the middle, and we’re going to change that to Blog.

After local changes, commit via Git push, just wait and refresh later to see the effect.

Gradle project

If your project is Gradle and you can execute a Task through the system, it can identify all the tasks in your project.

Secondary development

This project is developed using SpringBoot+(Vue+Vite). The Vue project is at the following address.

git@github.com:houxinlin/CoolDeploy-Web.git
Copy the code

We don’t use Nginx anymore, because it’s an extra step in the deployment process, which is a bit troublesome. After packing Vue, put it directly into the static directory of the SpringBoot project, and let Tomcat handle it.