hexo使用gitlab进行cicd

引子 由于个人博客过于松散,不想写完就发布到gitpage上,于是做了一个基于gitlab的cicd发布到内网 .gitlab-ci.yml编写 stages: build build: stage: build before_script: npm install export TRIGGER=diff # 指定触发规则 full:全量部署,diff:差异部署,不填:不执行操作 script: bash deploy Runner Runner安装 官方教程 # 这里以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环境 # hexo本体 npm install -g hexo-cli # 主题 npm install hexo-theme-butterfly 自动部署脚本编写 #!/bin/bash npx hexo g # 直接将静态文件覆盖到了runner所在nginx目录 cp public/* /usr/share/nginx/html/ -rf

2024-04-24 · 1 分钟 · ziwindlu · 源笔记:04-Solutions/hexo使用gitlab进行cicd.md

Hexo+GithubPage搭建个人博客

引子 大部分人的第一篇博客便是教人怎么搭建博客… 经历了备份失误,笔记软件迁移等一系列问题后,让我不得不重新从头整理自己的博客。本次更新添加了一些图片 软件安装 安装nodejs 安装hexo需要nodejs版本不低于10.13 去nodejs官网查看如何安装 检查是否正常运作 node -v npm -v 如有类似以下回显说明安装成功 [xxx@localhost ~]$ node -v v16.13.0 [xxx@localhost ~]$ npm -v 8.1.0 安装hexo npm install -g hexo-cli 搭建站点 hexo基本命令介绍 hexo官方文档 新建一个站点 hexo init [folder] 如果没有设置 folder ,Hexo 默认在目前的文件夹建立网站 新建一篇文章 hexo new [layout] <title> [layout]可选,没有的话默认使用_config.yml中的default_layout <title>必选,文章的名字 生成静态文件 hexo generate可简写为hexo g 启动服务 hexo server可简写为hexo s 搭建流程示例 新建一个hexo站点->编写文章->生成静态文件->启动服务 新建站点 hexo init myBlog 生成静态文件启动站点 hexo g && hexo s 将将,访问localhost:4000就可以看到你的站点啦 github设置 创建新的仓库 注意仓库名最好为githubUsername.github.io,这样可以避免出现css找不到的问题。 记录仓库地址 git@github.com:ziwindlu/ziwindlu.github.io.git 配置ssh公钥 部署到github 安装hexo-deployer-git npm install hexo-deployer-git --save 修改hexo配置文件 修改_config.yml deploy: type: git repository: git@github.com:ziwindlu/ziwindlu.github.io.git branch: main 将静态页面上传到github hexo clean && hexo g && hexo d 参考 文档 | Hexo

2024-04-08 · 1 分钟 · ziwindlu · 源笔记:04-Solutions/Hexo+GithubPage搭建个人博客.md