使用Github Action构建HTML时指定Hugo版本,使用peaceiris/actions-hugo@v2
这个Action,指定版本号即可。
name: HUGO-pages
on:
push:
branches:
- main # master 更新触发
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.123.0' # 使用指定的版本
extended: true
- name: Build
run: hugo --gc --minify --cleanDestinationDir
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.hugoblog }} # personal_token 这里新建一个 https://github.com/settings/tokens
PUBLISH_BRANCH: gh-pages # 推送到当前 gh-pages 分支
PUBLISH_DIR: ./public # hugo 生成到 public 作为跟目录
commit_message: ${{ github.event.head_commit.message }}
- name: Search
uses: jkjoy/hugo-algolia2@1.0.2
with:
input: "content/zh-cn/posts/**"
index: "blog"
apikey: ${{ secrets.ALGOLIA_WRITE_KEY }}
appid: "CIU4I6RWD0"
解决了最近Hugo版本升级,而我没有升级的问题。
主要原因是懒得动主题.