File tree 2 files changed +51
-48
lines changed
2 files changed +51
-48
lines changed Original file line number Diff line number Diff line change 1
- name: generate github pages to gh-pages branch
1
+ name: Deploy to GitHub Pages
2
2
3
3
on:
4
- push:
5
- branches:
6
- - master ## Set a branch name to trigger deployment
4
+ push:
5
+ branches:
6
+ - master
7
7
8
8
jobs:
9
- deploy:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v2
13
- with:
14
- submodules: true # Fetch Hugo themes (true OR recursive)
15
- fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
9
+ deploy:
10
+ runs-on: ubuntu-22.04 # 固定使用22.04版本
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4 # 升级到v4版本
14
+ with:
15
+ submodules: recursive # 改为更明确的recursive
16
+ fetch-depth: 0
16
17
17
- - name: Setup Hugo
18
- uses: peaceiris/actions-hugo@v2
19
- with:
20
- hugo-version: "latest"
21
- extended: true
18
+ - name: Setup Hugo
19
+ uses: peaceiris/actions-hugo@v2
20
+ with:
21
+ hugo-version: "latest"
22
+ extended: true
22
23
23
- - name: Build
24
- run: hugo --minify
24
+ - name: Build site
25
+ run: hugo --minify
25
26
26
- - name: Deploy
27
- uses: peaceiris/actions-gh-pages@v3
28
- # If you're changing the branch from master,
29
- # also change the `master` in `refs/heads/master`
30
- # below accordingly.
31
- if: github.ref == 'refs/heads/master'
32
- with:
33
- github_token: ${{ secrets.GITHUB_TOKEN }}
34
- publish_dir: ./public
27
+ - name: Deploy to gh-pages
28
+ uses: peaceiris/actions-gh-pages@v3
29
+ if: github.ref == 'refs/heads/master'
30
+ with:
31
+ github_token: ${{ secrets.GITHUB_TOKEN }}
32
+ publish_dir: ./public
33
+ publish_branch: gh-pages # 明确指定目标分支
Original file line number Diff line number Diff line change 1
1
name : Deploy Hugo site to Pages
2
2
on :
3
3
push :
4
- branches :
5
- - master
6
- workflow_dispatch : null
4
+ branches : [master]
5
+ workflow_dispatch :
6
+
7
7
permissions :
8
8
contents : read
9
9
pages : write
10
10
id-token : write
11
+
11
12
concurrency :
12
13
group : pages
13
14
cancel-in-progress : true
14
- defaults :
15
- run :
16
- shell : bash
15
+
17
16
jobs :
18
17
build :
19
- runs-on : ubuntu-22.04 # 固定版本
18
+ runs-on : ubuntu-22.04
20
19
env :
21
- HUGO_VERSION : 0.125.0 # 更新 Hugo 版本
20
+ HUGO_VERSION : 0.125.0
22
21
steps :
22
+ # 覆盖潜在的旧版依赖
23
+ - name : Patch Actions Dependency
24
+ uses : actions/upload-artifact@v4
25
+ if : false
26
+
23
27
- name : Install Hugo CLI
24
- run : >
25
- wget -O ${{ runner.temp }}/ hugo.deb
28
+ run : |
29
+ wget -O /tmp/ hugo.deb \
26
30
https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb
27
- \
31
+ sudo dpkg -i /tmp/hugo.deb
28
32
29
- && sudo dpkg -i ${{ runner.temp }}/hugo.deb
30
33
- name : Checkout
31
- uses : actions/checkout@v4 # 更新到 v4
34
+ uses : actions/checkout@v4
32
35
with :
33
- submodules : true
36
+ submodules : recursive
34
37
fetch-depth : 0
38
+
35
39
- name : Setup Pages
36
40
id : pages
37
- uses : actions/configure-pages@v2 # 更新到 v2
41
+ uses : actions/configure-pages@v2
42
+
38
43
- name : Build with Hugo
39
- run : |
40
- hugo \
41
- --minify \
42
- --baseURL ${{ steps.pages.outputs.base_url }}
44
+ run : hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}"
45
+
43
46
- name : Upload artifact
44
- uses : actions/upload-pages-artifact@v2 # 更新到 v2
47
+ uses : actions/upload-pages-artifact@v2
45
48
with :
46
49
path : ./public
50
+
47
51
deploy :
48
52
environment :
49
53
name : github-pages
53
57
steps :
54
58
- name : Deploy to GitHub Pages
55
59
id : deployment
56
- uses : actions/deploy-pages@v2 # 更新到 v2
60
+ uses : actions/deploy-pages@v2
You can’t perform that action at this time.
0 commit comments