File tree Expand file tree Collapse file tree 3 files changed +73
-5
lines changed Expand file tree Collapse file tree 3 files changed +73
-5
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy Hexo site to Pages
2
+
3
+ on :
4
+ # Runs on pushes targeting the `master` branch
5
+ push :
6
+ branches : [master]
7
+
8
+ # Allows manual trigger from the Actions tab
9
+ workflow_dispatch :
10
+
11
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12
+ permissions :
13
+ contents : read
14
+ pages : write
15
+ id-token : write
16
+
17
+ # Allow only one concurrent deployment, skipping queued runs
18
+ concurrency :
19
+ group : pages
20
+ cancel-in-progress : false
21
+
22
+ jobs :
23
+ # Build job
24
+ build :
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ # Check out the code
28
+ - name : Checkout
29
+ uses : actions/checkout@v4
30
+
31
+ # Set up Node.js environment
32
+ - name : Setup Node
33
+ uses : actions/setup-node@v4
34
+ with :
35
+ node-version : ' lts/*'
36
+ cache : npm
37
+
38
+ # Install dependencies
39
+ - name : Install dependencies
40
+ run : |
41
+ npm install
42
+ npm install -g hexo-cli
43
+ npm install hexo-theme-stellar
44
+ npm audit fix
45
+
46
+ # Generate static files with Hexo
47
+ - name : Build with Hexo
48
+ run : hexo generate
49
+
50
+ # Upload artifact
51
+ - name : Upload artifact
52
+ uses : actions/upload-pages-artifact@v3
53
+ with :
54
+ path : ./public
55
+
56
+ # Deployment job
57
+ deploy :
58
+ environment :
59
+ name : github-pages
60
+ url : ${{ steps.deployment.outputs.page_url }}
61
+ needs : build
62
+ runs-on : ubuntu-latest
63
+ name : Deploy
64
+ steps :
65
+ - name : Deploy to GitHub Pages
66
+ id : deployment
67
+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change @@ -11,21 +11,21 @@ node: 14.17.3 ~ 20.10.0 # 建议选择 LTS 版本,过高的版本 hexo 还
11
11
npm: 6.14.13 ~ 10.2.3
12
12
```
13
13
14
-
15
-
16
14
之后在` _config.yml ` 所在文件夹安装hexo-stellar(如果存在包问题则使用` npm audit fix ` 修复):
17
15
18
16
```
19
17
npm i hexo-theme-stellar
20
18
npm audit fix
21
19
```
22
20
23
-
24
-
25
21
最后按照Hexo的正常逻辑生成并本地启动即可。
26
22
27
23
```
28
24
hexo g
29
25
hexo s
30
26
```
31
27
28
+ ## 自动化部署(GitHub Actions)
29
+
30
+ 项目已配置 GitHub Actions 自动化部署。当代码推送到 ` main ` 分支时,GitHub Actions 会自动生成静态文件并部署到 GitHub Pages.
31
+
You can’t perform that action at this time.
0 commit comments