homepage hook
方案
本地编译, 将编译好的文件上传git并且文件自动部署到nginx
todo: 后期将原文件上传git通过action自动编译并部署
思路1
本地push到github, 通过webhook发送POST请求到VPS, 执行shell进行clone然后拷贝至nginx
问题: 服务器需要处理http请求
思路2
本地同时push到VPS和github, VPS通过hook执行shell拷贝至nginx
问题: 同时push两个仓库感觉不是很优雅
git
1 | adduser git --ingroup sudo # add user |
1 | mkdir ~/edlison/Home.git -p # new user dir and git repo |
copy local public key to git
1 | git remote set-url sj git@sj:edlison/Home.git # set push url |
hook
1 | cd ~/edlison/Home.git/hooks |
1 | echo "post-receive hook is running..." |
References
https://sampwood.github.io/2018/10/17/vps-git-repo-ngxin-git-hook
http://yearito.cn/posts/hexo-deploy-to-VPS.html