Using webHook to realize automatic update of hexo

In the last article, we mentioned the use of github webhook to realize the automatic update of hexo blog, and now we will implement this function. (ps: Users who have installed the pagoda panel can easily implement this function. All the following implementations are based on the pagoda panel installed on your VPS)

Install Pagoda WebHook

Log in to your Pagoda panel, select Software Management, find Pagoda WebHook 1.0 on the second page, and click Install. The process will take a few minutes, depending on your VPS configuration. Wait patiently for the installation to complete.

Configure Pagoda WebHook

After the installation is complete, click the Settings button on the right side of Pagoda WebHook 1.0, click Add, and create a new Hook.

The name can be arbitrarily chosen, and the execution script is as follows:

$ cd /www/wwwroot/blog
$ git pull

Very simple, enter the blog directory under your VPS, perform the pull operation to update the code to the VPS

Click Save to complete adding the hook.

This is to see that our newly added hook has appeared in the list. Click to view the key to see how to use the hook. I won't go into details here.

github sets the Webhook callback address

Log in to open your github project address, click setting, select Webhooks on the left, click add webhook, and write a link like this in the Payload URL column http://panel/hook?access_key=123¶m=aaa, replace the panel For your pagoda panel login address, the value of access_key is the hook key just generated. The latter param is a custom parameter, we won't use it here, so I won't talk about it.

Click the add webHook button to complete the settings on github.

Now we're done with the webHook automatically updating Hexo.

So we're running while blogging

$ hexo d

After the command, the code is automatically synced to the VPS and you can immediately visit the domain name to see the changes.

enjoy~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325542992&siteId=291194637