Setting up Hexo Auto-deploy from Gitlab
In a previous post I talked about why I like the idea of a static site generator, and the reasons for choosing to use one. In this post I want to share how I got mine set up to basically post everything with a single git push of the source. It may not be pretty, and it most certainly is not the best way to do it, but it works for me and the proof is in the pudding as it were.
Please also note that I am a total neophyte when it comes to the arcane art of CI and automated testing.
To automatically commit to your static site repo when it’s deployed, edit the hexo project’s _config.yml with the following.1
2
3
4
5
6# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
branch: master
repo: 'git@yourgitserver.com:staticblog.git'
With this I used the ssh commit method so make sure you generate an rsa key and register it to your gitlab commit runner’s user.