Commit Graph
1012 Commits
Author SHA1 Message Date
Write Server 4c5a7ce957 发布: 自建了 Gitea,测试一下部署 2026-10-01 05:51:21 +00:00
zqlit b9134cdd31 fix(ci): 修复提交信息含 ${{ }} 字样导致 pre-check 崩溃
根因:pre-check 的 Validate commit 步骤把 commit message 直接插值进 shell 脚本:

    COMMIT_MESSAGE="${{ github.event.head_commit.message }}"

多行提交信息会撑破脚本;若正文里出现 ${{ ... }} 之类字样(例如上一次提交
正文中的 ${{ gitea.* }}),bash 会把它当变量展开并报 "bad substitution",
exit 1 → pre-check failure → build 被 skip。

实证(Gitea task 35 日志):
    /var/run/act/workflow/commit-check: line 20: perf(ci): 兼容 GitHub Actions...
    : bad substitution
    ❌ Failure - Main Validate commit (only for push events)

修复:改用 step 级 env: 传值(COMMIT_AUTHOR / COMMIT_MESSAGE),
commit message 不再进入脚本文本。GitHub Actions 与 Gitea Actions
行为一致,两边都安全,同时消除命令注入面。

本次提交正文刻意保留了 ${{ gitea.* }} 字样,作为该修复的回归验证。
2026-10-01 12:37:22 +08:00
zqlit 671052c4de perf(ci): 兼容 GitHub Actions 并大幅缩短构建耗时
兼容性(迁移回 GitHub Actions 必需):
- 移除 5 处 ${{ gitea.* }} 专有上下文(Gitea 之外会求值失败),
  改为按 github.server_url 判断的 RUN_URL,GitHub / Gitea 通用
- Telegram / 飞书 / 邮件里的运行详情链接两边都正确

耗时优化:
- build: checkout 加 filter=blob:none(partial clone),
  保留完整提交历史供 Hugo 的 :git lastmod 使用,
  但不拉历史版本的文件内容(多为图片),省约 200MB 传输
- deploy-edgeone: 移除 checkout(原先约 81 秒),内联原 deploy_edgeone.sh
- finalize: 移除 checkout(约 145 秒)与 npm ci(约 66 秒),
  内联零依赖的 refresh_cdn.js(只用 node 内置 crypto 与 fetch)
- finalize: setup-node 不再启用 npm 缓存(本 job 已不安装依赖)

UpYun 相关按用户要求保持原样不动。
2026-10-01 12:22:41 +08:00
zqlit 97b725651f perf(ci): Gitea 环境跳过无效缓存,消除每次约 9 分钟空等
根因:/opt/gitea/runner/config.yaml 中 container.network=gitea_default
(job 容器落在 172.20.x),但 runner 容器自身只挂在 bridge 网络
(172.17.0.2),其提供的缓存服务 172.17.0.2:44869 跨 bridge 网段不可达。

实测证据:
- runner 容器内 wget http://127.0.0.1:44869/ -> HTTP 404(服务活着)
- gitea 容器 wget http://172.17.0.2:44869/  -> download timed out
- 构建日志:Setup Node restore 死等 278s(01:07:17 -> 01:11:55 ETIMEDOUT)
            Post Setup Node save 死等 288s(01:14:54 -> 01:19:42 ETIMEDOUT)
            Cache Hugo resources restore 亦超时
合计每次构建约 10 分钟纯浪费,且缓存从未真正命中或保存成功过。

改动:
- Setup Node 的 cache 改为按 github.server_url 条件启用;Gitea 上
  表达式求值为空串,setup-node 自动跳过缓存
- Cache Hugo resources 步骤加 if 条件,Gitea 上不执行(避免 restore+save 双超时)
- npm ci 增加 --no-audit --no-fund
- step summary 在 Gitea 上如实显示"已跳过",不再误报"未命中"

无副作用:npm ci 实测 68s 本就是在无缓存状态下跑的(restore 从未成功),
去掉缓存不会使其变慢;GitHub 侧行为完全不变。
2026-10-01 11:42:43 +08:00
zqlit cf27ab8eb5 fix(ci): 修复定时构建「无新提交则跳过」逻辑失效
根因:pre-check job 的 outputs.can_deploy 绑定在 steps.repo-check 上,
而该步骤是无条件写 true;真正写 can_deploy=false 的是 steps.cron-check,
它写进自己步骤的 outputs,从未被 job 级 output 采用。
于是 build 的 if: needs.pre-check.outputs.can_deploy == 'true' 恒为真。

证据(run 8, event=schedule):
- 日志 cron-check 已打印「距离上次提交: 9 小时 / 超过 1 小时没有新提交,跳过定时构建」
- 但随后 build 的 if 表达式求值
  'steps.repo-check.outputs.can_deploy' 结果为 true,build 照常执行

后果:每天北京 09:00 无条件全量构建(build ~17min + finalize ~12.5min),
2 核服务器被白占约 32 分钟/天。线上不受影响(build hash 未变,
COS/EdgeOne/UpYun 上传与部署均正确 skip)。

改动:
- 合并 repo-check 与 cron-check 为单一步骤 decide,统一计算并输出 can_deploy
- pre-check.outputs.can_deploy 改指向 steps.decide.outputs.can_deploy
- 去掉原 cron-check 的 exit 0(避免步骤提前中断导致 output 丢失)
2026-10-01 11:30:15 +08:00
zqlit dda5ce94b8 fix(ci): 加固 UpYun 上传步骤,修复 upx 下载挂死
根因:collection.b0.upaiyun.com 实测 2/3 概率整站无响应,
而 curl -sL 无 --max-time,导致步骤永久挂起直到 job 15 分钟超时。

改动:
- upx 主源改用 GitHub Releases(实测 0.5s 稳定),原 CDN 降为兜底
- curl 加 --connect-timeout/--max-time/--retry
- upx login/put 加 timeout 兜底,sync 加 480s 上限
- 删除无效的 Cache upx 步骤(缓存路径 /tmp 随 job 容器销毁,永远命中不了)
- 给 Upload to UpYun 加 timeout-minutes: 10
2026-09-30 23:37:53 +08:00
zqlit 34e9e2035a fix(ci): 用 Python 重写 pre-build 脚本,替换 PowerShell 依赖
Gitea 自建 runner 镜像不含 PowerShell,导致 Run Pre-Build Scripts
以 exitcode 127 失败。改用 Python 3(GitHub/Gitea runner 均预装),
跨平台通用,迁回 GitHub 无需改回。
2026-09-30 22:50:43 +08:00
zqlit c81e18f999 chore: 清理误提交的 .claude/worktrees gitlink
- 移除 4 个空目录 gitlink(导致 checkout 报 No url found for submodule path)
- .gitignore 忽略 .claude/worktrees/
2026-09-30 20:30:08 +08:00
zqlit a336bac54c chore: add Gitea Actions support and secrets checklist 2026-09-30 15:20:27 +08:00
Write Server 26d9faafc3 发布: GitHub用量又超了 2026-09-08 07:40:10 +00:00
Write Server 6be145b288 发布: 流量卡还真得选御三家😂 2026-07-24 02:23:34 +00:00
Write Server 7408d90c4e 发布: 最成功的一次红烧鱼 2026-07-19 03:52:07 +00:00
Write Server 7a67a17aad 发布: 国企面试,别太当回事儿 2026-07-08 03:20:35 +00:00
GitHub Actions 0637fecc8f chore: auto-optimize images [skip ci] 2026-07-04 10:09:26 +08:00
Write Server 8083152fb6 发布: 入手了智能手表 OPPO watch x3 2026-07-04 02:07:49 +00:00
Write Server 25a100bfcd 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 08:40:12 +00:00
Write Server e3ba1c7b18 发布: 复刻了某红书的西红柿鸡蛋炒牛肉 2026-06-30 08:27:51 +00:00
Write Server edd4384329 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 04:47:39 +00:00
Vaica baf766b0c1 Merge branch 'main' of https://github.com/zqlit/blog 2026-06-30 12:47:29 +08:00
Vaica 39aac24102 Update artalk.html 2026-06-30 12:47:27 +08:00
Write Server f0f80e81f1 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 04:21:19 +00:00
Vaica db3b751306 Merge branch 'main' of https://github.com/zqlit/blog 2026-06-30 11:52:46 +08:00
Vaica 46af56ece6 Update deploy.yml 2026-06-30 11:52:36 +08:00
Write Server 9015c68aac 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 03:49:12 +00:00
Vaica 30bf27fd2f Update deploy.yml 2026-06-30 11:41:34 +08:00
Vaica d7b4eeb13e Merge branch 'main' of https://github.com/zqlit/blog 2026-06-30 11:38:06 +08:00
Vaica 3c9beac251 Update deploy.yml 2026-06-30 11:38:03 +08:00
Write Server 3c37bc2cbf 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 03:21:38 +00:00
Write Server 2f36ccedb7 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 03:12:01 +00:00
Vaica 3222910f18 Update deploy.yml 2026-06-30 10:59:28 +08:00
Vaica 4087f2a7fc Update deploy.yml 2026-06-30 10:45:32 +08:00
Write Server d2c8972d57 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-30 02:37:45 +00:00
Vaica 2730299414 Update deploy.yml 2026-06-30 10:31:50 +08:00
Vaica cda5d6e00b Update deploy.yml 2026-06-30 10:24:51 +08:00
Vaica fa1bd63645 Update deploy.yml 2026-06-30 10:17:21 +08:00
Vaica 1f2a6f991b Update deploy.yml 2026-06-29 23:08:00 +08:00
Vaica 30c0cb3e97 Merge branch 'main' of https://github.com/zqlit/blog 2026-06-29 22:53:30 +08:00
Vaica 20954274b7 Update deploy.yml 2026-06-29 22:53:20 +08:00
Write Server a2762a7aaa 发布: GitHub Action 缓存额度超了,发不出文章😅 2026-06-29 14:45:57 +00:00
Vaica d344cb0c2a Update deploy.yml 2026-06-29 22:43:47 +08:00
Vaica ed16734d3c Update deploy.yml 2026-06-29 22:33:32 +08:00
Vaica de608d793f Update deploy.yml 2026-06-29 22:26:59 +08:00
Vaica e012c913fb Update deploy.yml 2026-06-29 22:09:22 +08:00
Vaica 5fc86efb30 Update deploy.yml 2026-06-29 21:58:53 +08:00
Vaica 163d60bde7 Update deploy.yml 2026-06-29 19:21:56 +08:00
Vaica bff1b7c769 Update deploy.yml 2026-06-29 19:16:40 +08:00
Vaica b198a745b9 Update deploy.yml 2026-06-29 19:14:07 +08:00
Vaica 64f7b43703 Update deploy.yml 2026-06-29 19:08:26 +08:00
Vaica 32bacd4e2e Update deploy.yml 2026-06-29 18:50:20 +08:00
Vaica 2dce33fd47 Update deploy.yml 2026-06-29 18:47:25 +08:00