Skip to content

Commit 05d7a89

Browse files
author
ma.jinyun
committed
fix actions/checkout error
1 parent 1f1941b commit 05d7a89

File tree

2 files changed

+51
-48
lines changed

2 files changed

+51
-48
lines changed

.github/._workflows

+26-27
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
name: generate github pages to gh-pages branch
1+
name: Deploy to GitHub Pages
22

33
on:
4-
push:
5-
branches:
6-
- master ## Set a branch name to trigger deployment
4+
push:
5+
branches:
6+
- master
77

88
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
1617

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
2223

23-
- name: Build
24-
run: hugo --minify
24+
- name: Build site
25+
run: hugo --minify
2526

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 # 明确指定目标分支

.github/workflows/gp.yml

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
11
name: Deploy Hugo site to Pages
22
on:
33
push:
4-
branches:
5-
- master
6-
workflow_dispatch: null
4+
branches: [master]
5+
workflow_dispatch:
6+
77
permissions:
88
contents: read
99
pages: write
1010
id-token: write
11+
1112
concurrency:
1213
group: pages
1314
cancel-in-progress: true
14-
defaults:
15-
run:
16-
shell: bash
15+
1716
jobs:
1817
build:
19-
runs-on: ubuntu-22.04 # 固定版本
18+
runs-on: ubuntu-22.04
2019
env:
21-
HUGO_VERSION: 0.125.0 # 更新 Hugo 版本
20+
HUGO_VERSION: 0.125.0
2221
steps:
22+
# 覆盖潜在的旧版依赖
23+
- name: Patch Actions Dependency
24+
uses: actions/upload-artifact@v4
25+
if: false
26+
2327
- name: Install Hugo CLI
24-
run: >
25-
wget -O ${{ runner.temp }}/hugo.deb
28+
run: |
29+
wget -O /tmp/hugo.deb \
2630
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
2832
29-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
3033
- name: Checkout
31-
uses: actions/checkout@v4 # 更新到 v4
34+
uses: actions/checkout@v4
3235
with:
33-
submodules: true
36+
submodules: recursive
3437
fetch-depth: 0
38+
3539
- name: Setup Pages
3640
id: pages
37-
uses: actions/configure-pages@v2 # 更新到 v2
41+
uses: actions/configure-pages@v2
42+
3843
- 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+
4346
- name: Upload artifact
44-
uses: actions/upload-pages-artifact@v2 #更新到 v2
47+
uses: actions/upload-pages-artifact@v2
4548
with:
4649
path: ./public
50+
4751
deploy:
4852
environment:
4953
name: github-pages
@@ -53,4 +57,4 @@ jobs:
5357
steps:
5458
- name: Deploy to GitHub Pages
5559
id: deployment
56-
uses: actions/deploy-pages@v2 # 更新到 v2
60+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)