Hugo配置Github Actions
最近把博客的构建工具从Hexo换成了Hugo,感觉Hugo配置和使用起来更简洁方便。 由于我的博客总体来说有两个仓库,一个私有仓库是放置建站工具的目录,其中包含博客 Markdown 内容、一些配置还有主题;另一个就是通过 GitHub Pages 来访问公共仓库。为了方便,之前在使用 Hexo 的使用使用了 Github Actions 来一键部署博客,换成 Hugo 后这个 actions 需要修改一下。 .github/workflows/hugo.yml: name: GitHub Pages on: push: branches: - master # 监听 master 分支的推送事件 pull_request: jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: true # 拉取 Hugo 主题子模块 fetch-depth: 0 # 获取完整提交历史 - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: hugo-version: '0.126.2' extended: true - name: Build run: hugo --minify # 启用压缩优化 - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: personal_token: ${{ secrets....