File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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 分支,无需修改
You can’t perform that action at this time.
0 commit comments