Skip to content

Commit c9cf76f

Browse files
committed
增加流水线
1 parent 98b9e89 commit c9cf76f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/workflow.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy Hugo Site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ] # 监听 main 分支的推送
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
submodules: true # 拉取主题子模块
15+
fetch-depth: 0
16+
17+
- name: Setup Hugo
18+
uses: peaceiris/actions-hugo@v2
19+
with:
20+
hugo-version: 'latest' # 使用最新版 Hugo
21+
extended: true # 启用 extended 版本
22+
23+
- name: Build site
24+
run: hugo --minify # 构建并压缩静态文件
25+
26+
- name: Deploy to GitHub Pages
27+
uses: peaceiris/actions-gh-pages@v4
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }} # 自动生成的 Token
30+
publish_dir: ./public # 部署 public 目录
31+
# 若部署到个人主页(yourname.github.io),需设置为 main 分支:
32+
publish_branch: main
33+
# 若部署到项目站点,默认部署到 gh-pages 分支,无需修改

0 commit comments

Comments
 (0)