9 Commits
Author SHA1 Message Date
tao.chen 2f026946b6 ci: rollback
CI / Release / CI (push) Successful in 3m35s
CI / Release / Release (push) Skipped
2026-07-20 13:50:28 +08:00
tao.chen c02479381f ci: update bark uri
CI / Release / CI (push) Failing after 43s
CI / Release / Release (push) Skipped
2026-07-20 13:47:39 +08:00
tao.chen ec5292f9f7 ci: rollback
CI / Release / CI (push) Successful in 3m30s
CI / Release / Release (push) Has been skipped
2026-07-15 18:57:05 +08:00
tao.chen fefd816a21 ci: update Checkout uses
CI / Release / CI (push) Failing after 30s
CI / Release / Release (push) Has been skipped
2026-07-15 18:51:30 +08:00
tao.chenandClaude 2571ce69c0 ci: 换 gitea/action-checkout 替代手写 git clone
CI / Release / CI (push) Failing after 8s
CI / Release / Release (push) Has been skipped
上一轮改用 git clone 手写 checkout 是因为 actions/checkout@v4 是
Node 实现, alpine golang-1.25 镜像没装 Node. 但后来发现镜像连
bash 也没有 (alpine 极简镜像, 只剩 sh), run: | 块也会崩.

gitea/action-checkout 是 Gitea 官方 Go 实现的 checkout action,
不依赖 Node 也不依赖 bash, 跟 Gitea runner 原生集成. 替换两个
job 的 checkout step.

注意: gitea/action-checkout 只解决 checkout. 后续 run: | 块
(Set GOPROXY / Build / Test / Upload release asset / Notify) 仍
然用 bash, alpine 没 bash 会继续崩. 这是已知遗留, 跑起来再看
是否真崩. 完整修法是给所有 run: | 块加 shell: sh, 但本 commit
先按用户要求只换 checkout, 观察跑结果再决定.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 18:48:25 +08:00
tao.chenandClaude 160c9f32c8 ci: 用 git clone 替换 actions/checkout (alpine 无 Node)
CI / Release / CI (push) Failing after 44s
CI / Release / Release (push) Has been skipped
alpine golang-1.25 镜像没装 Node, actions/checkout@v4 启动失败:

  Run Checkout
  OCI runtime exec failed: exec failed: unable to start container
  process: exec: "node": executable file not found in \$PATH: unknown

actions/checkout 是 Node.js 应用, Gitea alpine runner 镜像不
带 Node. 改用 git clone 手写 checkout step:

  git clone --depth 1 "\${{ github.server_url }}/\${{ github.repository }}.git" .

shallow clone (\$depth 1) 减少传输量, \${{ github.server_url }} 自动
填入 Gitea 实例 URL, \${{ github.repository }} 是 owner/repo 路径.

这个 runner 应该跟 Gitea 在同一网络, 仓库公开, 不需要 auth
token. 如果将来换 runner 跨网络或者仓库私有, 改成:

  git clone --depth 1 \\
    -c http.extraHeader="Authorization: token \$GITEA_TOKEN" \\
    "\${{ github.server_url }}/\${{ github.repository }}.git" .

GITEA_TOKEN 走 \${{ secrets.GITHUB_TOKEN }} (Gitea 自动注入).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 18:45:31 +08:00
tao.chenandClaude e5f7d661b4 ci: 切到 Gitea golang-1.25 runner, alpine 镜像
CI / Release / CI (push) Failing after 49s
CI / Release / Release (push) Has been skipped
Gitea runner 现在用 golang-1.25 标签 (alpine + Go 1.25 预装), 不
再需要 wget + tar 装 Go. 删 "Install Go (Mirror in China)" step,
保留 GOPROXY 设置 (alpine 默认 GOPROXY=proxy.golang.org, 国内
runner 慢).

runner: golang-1.25 (两 job 都改)
step 1: actions/checkout@v4 (alpine 已有, 不需要 apt 装 git)
step 2: "Set GOPROXY" 写 \$GITHUB_ENV, 后续 step 继承
        (https://goproxy.cn/,https://goproxy.io,direct)

grep -P 兼容性 fix: alpine busybox grep 不支持 -P (PCRE). 之前
release job 用 grep -oP '"id":\s*\K[0-9]+' 拆 release id, 在
alpine 上会 "grep: unrecognized option". 改两次 grep -o:
  grep -o '"id":[0-9]*' | head -n 1 | grep -o '[0-9]*'
  第 1 个 grep 拉出 "id":<num>, 第 2 个去掉引号和 key 名.
不依赖 -P, POSIX grep 也跑.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 18:40:43 +08:00
tao.chenandClaude 6f4c3a3e21 ci: Bark 推送逻辑提到独立脚本, 两 job 复用
CI / Release / CI (push) Successful in 3m15s
CI / Release / Release (push) Successful in 4m43s
之前 ci/release 各自 inline 拼 payload + curl, 重复 25 行 x 2.
device_key / endpoint / group / ttl 硬编码两次, 改一处忘另一处
会出现两个不同 group 的推送.

新建 .github/scripts/bark-notify.sh:
  bash .github/scripts/bark-notify.sh "<title>" "<body>"

脚本封装:
  - endpoint / device_key / group (Gitea) / isArchive / ttl 单一来源
  - heredoc 拼 JSON, 不依赖 jq
  - 错误用法打印 usage 并 exit 1 (set -euo pipefail)

workflow 两处都改成一行:
  bash .github/scripts/bark-notify.sh "CI \${REF_NAME} \${STATUS}" "\${BODY}"
  bash .github/scripts/bark-notify.sh "\${TAG_NAME} \${STATUS}" "\${BODY}"

emoji (/) 跟 status 映射仍在 workflow 里, 因为不同 job 拼
不同的 title prefix (CI vs release), 脚本不管这个, 调用方传什么
就推什么.

chmod +x 加在 commit 里, 但 git mode bit 在 .gitattributes 或
core.fileMode 关时可能丢. runner 一般会按 working tree 模式跑,
不需要额外 chmod 在 step 里.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 16:36:07 +08:00
tao.chenandClaude 44a30c4a8a ci: Bark 通知 group 改 Gitea, CI/Release 成功失败都推
CI / Release / CI (push) Successful in 2m52s
CI / Release / Release (push) Has been skipped
group 从 "release" 改为 "Gitea" — 不再按事件分类, 跟 Bark 设备
group 设置对齐.

两个 job (ci / release) 都加 if: always() Bark step, 任何结束
状态 (success / failure / cancelled) 都推送. 之前 release job
只在 success() 触发, 失败时收不到通知, 调试慢.

通知内容带 job.status:
  - 成功: 标题 "v1.0.0 success", body 加  emoji + release URL
  - 失败: 标题 "v1.0.0 failure", body 加  emoji + release URL
           (release job 失败时) 或 actions run URL (ci job 失败时)

Bark 端 group 分类: "Gitea" group 收所有 CI/release 推送, 用户
在 Bark 设备上一目了然.

\${{ job.status }} 是 GitHub Actions 标准 context, Gitea 兼容
(API-compatible).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 16:33:41 +08:00
2 changed files with 61 additions and 19 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# bark-notify.sh — push a notification to the local Bark server.
#
# Usage: bark-notify.sh <title> <body>
#
# The Bark endpoint, device_key, and group are pinned in this script
# (it is a deployment detail, not a secret). The group is "Gitea" —
# change it here if you want to sort notifications by category.
set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "usage: $0 <title> <body>" >&2
exit 1
fi
TITLE="$1"
BODY="$2"
PAYLOAD=$(cat <<EOF
{
"device_key": "6ZFVsxM95cuAjYoNLWSWaN",
"title": "${TITLE}",
"body": "${BODY}",
"group": "Gitea",
"isArchive": 1,
"ttl": 3600
}
EOF
)
curl -s \
-X POST http://101.43.40.124:81/push \
-H "Content-Type: application/json; charset=utf-8" \
-d "${PAYLOAD}"
echo "bark notified: ${TITLE}"
+24 -19
View File
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Install Go (Mirror in China)
run: |
@@ -49,6 +49,19 @@ jobs:
exit 1
fi
- name: Notify CI via Bark
if: always()
run: |
REF_NAME="${{ github.ref_name }}"
STATUS="${{ job.status }}"
if [ "${STATUS}" = "success" ]; then
EMOJI="✅"
else
EMOJI="❌"
fi
BODY="${EMOJI} ${REF_NAME} ${STATUS}: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}"
bash .github/scripts/bark-notify.sh "CI ${REF_NAME} ${STATUS}" "${BODY}"
release:
name: Release
needs: ci
@@ -56,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Install Go (Mirror in China)
run: |
@@ -106,22 +119,14 @@ jobs:
-F "attachment=@spark-mcp-linux-amd64"
- name: Notify release via Bark
if: success()
if: always()
run: |
TITLE="${{ github.ref_name }}"
BODY="spark-mcp ${TITLE} released: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TITLE}"
PAYLOAD=$(cat <<EOF
{
"device_key": "6ZFVsxM95cuAjYoNLWSWaN",
"title": "${TITLE}",
"body": "${BODY}",
"group": "release",
"isArchive": 1,
"ttl": 3600
}
EOF
)
curl -s \
-X POST http://101.43.40.124:81/push \
-H "Content-Type: application/json; charset=utf-8" \
-d "${PAYLOAD}"
STATUS="${{ job.status }}"
if [ "${STATUS}" = "success" ]; then
EMOJI="✅"
else
EMOJI="❌"
fi
BODY="${EMOJI} spark-mcp ${TITLE} ${STATUS}: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TITLE}"
bash .github/scripts/bark-notify.sh "${TITLE} ${STATUS}" "${BODY}"