构建自己的云上工作流-Hexo自动部署

前言

Hexo,一个快速、简洁且高效的博客框架。在各种的插件与主题之下,结合管理面板使用,可以与其获得与WordPress和typecho相媲美的优势所在。

通过示例Github仓库构建

内部版本:

主程序:
Hexo:6.3.0

主题:
Hexo-theme-butterfly:4.8.5
Yun主题已经分支,有需要可前往Yun分支下查看,主分支已经更新为Butterfly主题!
Hexo-theme-yun:1.10.9

部署到Vercel

Deploy with Vercel

部署到Netlify

部署到Cloudflare Pages

建议通过以上两种方式构建仓库之后,再用git方式添加到pages部署

用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
name: Deploy By GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 - name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install Dependencies
run: npm i
- run: npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repository: 你的Github用户名/你的Github仓库名
publish_dir: ./public
publish_branch: gh-pages
force_orphan: true

公有方式部署(指部署仓库公有)

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
  name: Deploy By GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install Dependencies
run: npm i
- run: npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: gh-pages
force_orphan: true