Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

  

hexo github pages 自动部署

.github\workflows\autodeploy.yml

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
# 当有改动推送到master分支时,启动Action
name: 自动部署

on:
push:
branches:
- source #监听source分支的push事件

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: 检查分支
uses: actions/checkout@v4
with:
ref: source #检出source分支的代码

- name: 安装 Node
uses: actions/setup-node@v4
with:
node-version: "25.x" #action使用的node版本,建议大版本和本地保持一致。可以在本地用node -v查询版本号。

- name: 安装 Hexo
run: |
export TZ='Asia/Shanghai'
npm install hexo-cli -g

- name: 缓存 Hexo
uses: actions/cache@v4
id: cache
with:
path: |
node_modules
~/.npm
key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}

- name: 安装依赖
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install --save

- name: 生成静态文件
run: |
hexo clean
hexo generate

- name: 上传静态文件
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: ./public

- name: 部署到 GitHub Pages
uses: actions/deploy-pages@v4

  

:D 一言句子获取中...