- Create a new repository named username.gitlab.io, where username is your username on GitLab. If you have already uploaded to other repo, rename the repo instead.
- Enable Shared Runners via Settings > CI/CD > Runners > Enable shared runners for this project.
- Push the files of your Hexo folder to the repository. The
public/folder is not (and should not be) uploaded by default, make sure the
public/line. The folder structure should be roughly similar to this repo.
- Check what version of Node.js you are using on your local machine with
node --version. Make a note of the major version (e.g.,
.gitlab-ci.ymlfile to the root folder of your repo (alongside _config.yml & package.json) with the following content (replacing
16with the major version of Node.js you noted in previous step):
- username.gitlab.io should be up and running, once GitLab CI finishes the deployment job,
- (Optional) If you wish to inspect the generated site assets (html, css, js, etc), they can be found in the job artifact.
If you prefer to have a project page on GitLab:
- Go to Settings > General > Advanced > Change path. Change the value to a name, so the website is available at username.gitlab.io/repository. It can be any name, like blog or hexo.
- Edit _config.yml, change the
- Commit and push.