hugo建站工具通过github action自动发布到github page
hugo建站工具通过github action自动发布到github page.
官方参考地址: https://gohugo.io/hosting-and-deployment/hosting-on-github/
name: github pages
on:
push:
branches:
- main # Set a branch to deploy
pull_request:
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
# extended: true
- name: Build
run: cd ./blog && hugo
- name: git clone
run: git clone https://github.com/xinxiaoyu/xinxiaoyu.github.io.git && cp -rf ./blog/public/* ./xinxiaoyu.github.io/
- name: deploy
working-directory: ./xinxiaoyu.github.io
run: git config --global user.email "denifears@gmail.com" && git config --global user.name "xinxiaoyu" && git add * && git commit -m "123" && git remote set-url origin https://xinxiaoyu:${{ secrets.ACCESS_TOKEN }}@github.com/xinxiaoyu/xinxiaoyu.github.io.git && git push