准备详细说明……

0x00.缘由

升级搞崩了,于是重新做人

0x01.安装Node.js

每次去看都有更新,速度实在是太快了
每次去看都有更新,速度实在是太快了
坚决拒绝全家桶,不解释
坚决拒绝全家桶,不解释

配置淘宝NPM镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org

0x02.安装Hexo

作者台湾大学生
作者台湾大学生
1
2
3
4
cnpm install hexo-cli -g
hexo init blog
cd blog
cnpm install
全局安装
全局安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cnpm install hexo-renderer-less --save
cnpm install hexo-generator-feed --save
cnpm install hexo-generator-json-content --save
cnpm install hexo-helper-qrcode --save

cnpm install hexo-all-minifier --save
cnpm install hexo-wordcount --save
cnpm install hexo-generator-restful --save

cnpm install hexo-server --save
cnpm install hexo-helper-live2d --save
cnpm install hexo-filter-date-from-git --save
cnpm install hexo-native-lazy-load --save

hexo clean && hexo g && hexo s

貌似有package.json或者package-lock.json的话会自动安装上

0x03.源码仓库

源码放在了gh上,虽说这样的话整个网站容易已经被直接一锅端走(Fork),但是最终还是选择了这里
因为要配合Travis CIgh公开仓库免费部署(跑编译)而私有仓库就得付费了……
具体的方法网上有一大堆可参考引用第一条,大概都是gh账号注册CI,然后开启项目开关,写好脚本和环境变量再设置设置就ok
迁移还算顺利,现在的流程是:写完新文章提交到gh上,CI编译完推送到Coding企业版,最后会自动部署静态网站
暂时还没有用到Coding企业版的CI,其实主要还是Jenkins的语法过于复杂……还是Travis CI好!

gh
gh
CI
CI
log
log
说明
说明
使用访问令牌推送可省去配置 ssh 密钥的麻烦
使用访问令牌推送可省去配置 ssh 密钥的麻烦
代码更新时自动部署静态网站
代码更新时自动部署静态网站
部署成功
部署成功

顺便把gh的源码clone到了CloudStudio之中,这样上班太困了想摸鱼写写博客的话也是ok的,所谓的代码不落地可海星(Doge

CloudStudio
CloudStudio

0x04.Signing commits

You can sign your work locally using GPG or S/MIME. GitHub will verify these signatures so other people will know that your commits come from a trusted source. GitHub will automatically sign commits you make using the GitHub web interface.

web上的提交会被gh自动签名,本地提交需要使用GnuPG进行签名
官方文档Managing commit signature verification,根据交互提示创建不少于4096(官方要求)位的公私钥对

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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<rm>@<rm> MINGW64 ~
$ gpg --list-secret-keys --keyid-format LONG
gpg: keybox '/c/Users/<rm>/.gnupg/pubring.kbx' created
gpg: /c/Users/<rm>/.gnupg/trustdb.gpg: trustdb created

<rm>@<rm> MINGW64 ~
$ gpg --list-secret-keys --keyid-format LONG

<rm>@<rm> MINGW64 ~
$ gpg --list-key

<rm>@<rm> MINGW64 ~
$ gpg --full-generate-key
gpg (GnuPG) 2.2.16-unknown; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 1y
Key expires at Fri, May 21, 2021 4:03:37 PM CST
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: yuangezhizao-workaccount
Email address: [email protected]
Comment:
You selected this USER-ID:
"yuangezhizao-workaccount <[email protected]>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 7C5AD4EFEBE22E2C marked as ultimately trusted
gpg: directory '/c/Users/<rm>/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/c/Users/<rm>/.gnupg/openpgp-revocs.d/529AB9F612C9EA2303836DCE7C5AD4EFEBE22E2C.rev'
public and secret key created and signed.

pub rsa4096 2020-05-21 [SC] [expires: 2021-05-21]
529AB9F612C9EA2303836DCE7C5AD4EFEBE22E2C
uid yuangezhizao-workaccount <[email protected]>
sub rsa4096 2020-05-21 [E] [expires: 2021-05-21]


<rm>@<rm> MINGW64 ~
$ gpg --list-secret-keys --keyid-format LONG
/c/Users/<rm>/.gnupg/pubring.kbx
----------------------------------------
sec rsa4096/7C5AD4EFEBE22E2C 2020-05-21 [SC] [expires: 2021-05-21]
529AB9F612C9EA2303836DCE7C5AD4EFEBE22E2C
uid [ultimate] yuangezhizao-workaccount <[email protected]>
ssb rsa4096/1D59D7933E6D6D58 2020-05-21 [E] [expires: 2021-05-21]


<rm>@<rm> MINGW64 ~
$ gpg --list-key
/c/Users/<rm>/.gnupg/pubring.kbx
----------------------------------------
pub rsa4096 2020-05-21 [SC] [expires: 2021-05-21]
529AB9F612C9EA2303836DCE7C5AD4EFEBE22E2C
uid [ultimate] yuangezhizao-workaccount <[email protected]>
sub rsa4096 2020-05-21 [E] [expires: 2021-05-21]

0x05.引用

使用Travis CI自动部署Hexo博客
使用 Travis CI 自动部署 HEXO 博客
使用 travis-ci 持续集成 Hexo 静态博客
使用 Travis CI 自动部署 Hexo 博客
使用travis-ci自动部署Hexo到github和coding
用TravisCI持续集成自动部署Hexo博客的个人实践

未完待续……