0%

hexo 博客如果是部署在 github page 上的话,可以通过 Github action 实现自动部署,免去手动生成上传的麻烦,每次修改将源码提交即可自动开始部署

示例Github action代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: A job to deploy blog.
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true # Checkout private submodules(themes or something else).

- name: apt install & upgrade nodejs & install hexo
run: |
node -v
echo "-------------"
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "-------------"
node -v
sudo npm install -g hexo hexo-cli

- name: npm install --save
run: |
ls
npm install --save
- name: Git Global variable
run: |
git config --global user.email "Your email"
git config --global user.name "Your name"
git config --global init.defaultBranch main

- name: Hexo deploy key
env:
ACTION_DEPLOY_KEY: ${{ secrets.HEXO_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts

- name: hexo generate & deploy
run: |
ls
echo "Generate hexo site"
hexo g
echo "--------------"
cd ..
pwd
echo "Tree -L 2"
tree -L 2
echo "Deploy hexo site"
hexo d

GitHub Deploy key配置

  • 在Linux命令行输入
1
ssh-keygen -t rsa -C "hexo"
  • 生成RSA加密的ssh密钥对,位于当前目录下,hexo.pub为公钥,hexo为私钥

  • 复制hexo.pub内容到Settings -> Deploy key的新建项

  • Settings -> Secret key创建HEXO_DEPLOY_KEY,value为刚刚生成的hexo私钥内容

  • 根据需要修改deploy.yml内容创建自动部署Hexo的Action

这样在每次push到仓库的时候都能等1min左右完成Github page的自动生成部署

需要注意的

  • hexo 依赖于Nodejsnpm包管理器,请现在本地参照Hexo官方文档部署后,在Git项目中添加.gitignore忽略掉以下内容的提交,不上传node_modules等依赖文件,GithubAction会根据npm install --save生成的package.json自动安装配置相关npm包的依赖(即package.json包含npm包的依赖信息):
阅读全文 »

这是我的coc-nvim的配置文件,Coc-nvim是一个继承自Vim的高度可定制代码自动补全插件,有很多优秀的开源插件可供选择,媲美微软的VScode

获取更多信息请移步我的Github项目
https://github.com/zhzhzhy/coc-vimrc

This is my coc-nvim configuration file document

refer Here in Github repository for more detail

Vim Installation

Installation Guide

Github page

Neovim Installation(Optional)

Neovim

Neovim is a project that seeks to aggressively refactor Vim in order to:

阅读全文 »