关于hexo静态博客,最初是使用github部署的,然而国内访问体检不佳,于是更换为gitlab.
参考文章
参考以下, 基本可以一步一步解决问题.
Gitlab博客实例参考
注意事项
gitlab创建仓库,仓库名格式为username.gitlab.io
gitlab.com/username/username.gitlab.io配置文件.gitlab-ci.yml
image: node:20.18.0
cache:
paths:
- node_modules/
before_script:
- npm install hexo-cli -g
- test -e package.json && npm install
- hexo generate
pages:
tags:
- update
script:
- hexo generate
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
gitlab仓库配置runer,具体“setting/CI-CD/Runners”, 编辑任务,取消“匹配tag才触发任务“
==配置好本地gitlab-runer后, 需要全局代理,打开dokcer-desktop后,提交变更后才能部署成功==
仓库设置为公开/私密方法:
Access Control is enabled for this Pages website; only authorized users will be able to access it. To make your website publicly available, navigate to your project’s Settings > General > Visibility and select Everyone in pages section. Read the documentation for more information.
域名绑定
博客优化
增加留言评论