引子
由于个人博客过于松散,不想写完就发布到gitpage上,于是做了一个基于gitlab的cicd发布到内网
.gitlab-ci.yml编写
1 2 3 4 5 6 7 8 9
| stages: - build build: stage: build before_script: - npm install - export TRIGGER=diff script: - bash deploy
|
Runner
Runner安装
官方教程
1 2 3 4
| # 这里以centos7,x86_64架构做演示 # 下载rpm包并安装 curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm" rpm -i gitlab-runner_amd64.rpm
|
hexo环境
1 2 3 4
| # hexo本体 npm install -g hexo-cli # 主题 npm install hexo-theme-butterfly
|
自动部署脚本编写
1 2 3 4
| #!/bin/bash npx hexo g # 直接将静态文件覆盖到了runner所在nginx目录 cp public/* /usr/share/nginx/html/ -rf
|