Deploy to Github Pages #1421
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 to Github Pages | |
on: | |
schedule: | |
- cron: '*/5 * * * *' # 每 5 分钟运行一次 | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update submodule | |
run: | | |
git submodule update --remote --recursive | |
- name: Cache Hugo resources | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-hugo-resources | |
with: | |
path: resources | |
key: ${{ env.cache-name }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "^1.17.0" | |
- run: go version | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "latest" | |
extended: true | |
- name: Build | |
run: hugo --minify --gc | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: public | |
clean: true | |
single-commit: true |