Files
blog/.gitea/workflows/build.yml
T
zhengchen.tao e4f249ace5 ci: 砍掉构建里的多余动作
- fetch-depth: 0 → 默认浅克隆(没启用 enableGitInfo,Hugo 不读 git 历史)
- submodules: recursive → true(只有 themes/stack 一层,无嵌套)
- install → mv(二进制解压即可执行,不需要 chmod/chown)
2026-05-04 01:11:48 +08:00

40 lines
1.1 KiB
YAML

name: Build and Deploy Blog
on:
push:
branches: [main]
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
# host 模式:step 直接在 gitea-runner 容器内跑(Alpine),
# /blog-public 由 runner docker-compose 直接 bind 到 NAS,无需 act_runner 注入
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Hugo Extended
run: |
HUGO_VERSION=0.161.1
curl -fsSL "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | tar -xz
mv hugo /usr/local/bin/
hugo version
- name: Build site
run: hugo --gc --minify
- name: Deploy to /blog-public
run: |
[ -d /blog-public ] || { echo "::error::/blog-public missing, runner compose 没挂上"; exit 1; }
rsync -av --delete public/ /blog-public/