edit readme #3
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: deploy # 名字随意 | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: false # Fetch Hugo themes (true OR recursive) 获取submodule主题 | ||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | ||
- name: Setup Hugo # 步骤名自取 | ||
uses: peaceiris/actions-hugo@v2 # hugo官方提供的action,用于在任务环境中获取hugo | ||
with: | ||
hugo-version: 'latest' # 获取最新版本的hugo | ||
# extended: true | ||
- name: Build | ||
run: hugo --minify # 使用hugo构建静态网页 | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 # 一个自动发布github pages的action | ||
with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} 该项适用于发布到源码相同repo的情况,不能用于发布到其他repo | ||
external_repository: {username}/{username}.github.io # 发布到哪个repo | ||
personal_token: ${{ secrets.ACTION_ACCESS_TOKEN }} # 发布到其他repo需要提供上面生成的personal access token | ||
publish_dir: ./public # 注意这里指的是要发布哪个文件夹的内容,而不是指发布到目的仓库的什么位置,因为hugo默认生成静态网页到public文件夹,所以这里发布public文件夹里的内容 | ||
publish_branch: main # 发布到哪个branch |