Skip to content

GitHub Pages

GitHub Pages #236

Workflow file for this run

name: GitHub Pages
on:
push:
pull_request:
workflow_dispatch:
schedule:
# Runs everyday at 8:00 AM
- cron: "0 0 * * *"
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Disable quotePath
run: git config --global core.quotePath false
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --minify
- name: Install nodejs
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm i pagefind #配置搜索工具
- run: npx pagefind --source public --bundle-dir search #使用pagefind生成静态索引
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
# Note that the GITHUB_TOKEN is NOT a personal access token. A GitHub Actions runner automatically creates a
# GITHUB_TOKEN secret to authenticate in your workflow. So, you can start to deploy immediately without any
# configuration.
# 不用管这个 secret,github action 会自动创建
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repository: mewoooew/mewoooew.github.io
publish_branch: master
keep_files: false
publish_dir: ./public
commit_message: ${{github.event.head_commit.message }}