Create hugo.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Hugo Build and Deploy | |
on: | |
push: | |
branches: | |
- blog | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 第一步:检出源码 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
# 如果你的主题是作为子模块存在于主仓库中,需要设置为true | |
submodules: false | |
# 获取所有历史记录,用于生成最后修改时间等信息 | |
fetch-depth: 0 | |
# 第二步:安装hugo | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
# 指定hugo版本,根据你自己的需要修改 | |
hugo-version: 'latest' | |
# 是否使用hugo扩展版,根据你自己的需要修改 | |
# extended: true | |
# 第三步:构建博客静态文件 | |
- name: Build | |
run: hugo --minify | |
# 第四步:部署到master分支 | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
# 使用github提供的token进行身份验证 | |
github_token: $ { { secrets.GITHUB_TOKEN }} | |
# 指定推送到的仓库名,注意修改为你自己的仓库名 | |
publish_repo: ramsong/ramsong.github.io | |
# 指定推送到的分支名,这里使用master分支 | |
publish_branch: master | |
# 指定静态文件所在的目录,这里是public目录 | |
publish_dir: ./public |