chore(guard): 发布脚本与 pre-push 都接插件两仓一致性检查
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 49s

- scripts/release.sh、scripts/publish-update.sh:开头加前置门禁(不一致直接退出,不发包不传 NAS),
  末尾加收尾复核(发布过程中若有人手改产物层,这里立刻暴露)
- scripts/git-hooks/pre-push + scripts/install-git-hooks.sh + npm run hooks:install:
  推送桌面仓前自动比对两仓,不一致拒绝推送;源仓不存在时跳过(CI/别人机器不阻塞)
- docs/standards/plugin-source-of-truth.md §4 补「四道关卡」表与钩子安装方法
This commit is contained in:
qiqi committed 2026-11-29 12:35:33 +08:00
1 parent fd9575a96e
commit 43de3b0054
6 files changed
+55 -1

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# pre-push:推送前校验桌面仓 plugins/ 与插件源仓一致(v3.26.109)
# 由 scripts/install-git-hooks.sh 安装;源仓不存在时 check 脚本会自行跳过。
root=$(git rev-parse --show-toplevel)
if ! node "$root/scripts/check-plugins-sync.js"; then
echo ''
echo '[pre-push] 插件两仓不一致,已阻止推送。'
echo '[pre-push] 正确做法:在 iwb-plugins-desktop 改源码 → 桌面仓 node scripts/sync-plugins-from-repo.js'
echo '[pre-push] 说明:docs/standards/plugin-source-of-truth.md'
exit 1
fi
exit 0
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# 安装仓库自带的 git hooks(目前只有 pre-push:插件两仓一致性)
set -e
root=$(cd "$(dirname "$0")/.." && pwd)
hooks="$root/.git/hooks"
[ -d "$hooks" ] || { echo "找不到 $hooks"; exit 1; }
for f in "$root"/scripts/git-hooks/*; do
name=$(basename "$f")
cp "$f" "$hooks/$name"
chmod +x "$hooks/$name"
echo "installed .git/hooks/$name"
done
+7
View File
@@ -17,6 +17,10 @@
set -euo pipefail
cd "$(dirname "$0")/.."
# 插件两仓一致性(v3.26.109):桌面仓 plugins/ 必须等于插件源仓,否则发布的包/市场会和源码分叉。
# 源仓不存在时脚本自身会跳过(CI / 别人机器不阻塞)。见 docs/standards/plugin-source-of-truth.md。
node scripts/check-plugins-sync.js || { echo '✗ 插件两仓不一致,已停止发布(先同步插件源仓)'; exit 1; }
[ $# -ge 1 ] && node scripts/set-version.js "$1"
V=$(node -e "console.log(require('./package.json').version)")
KEY="${TAURI_SIGNING_PRIVATE_KEY:-$HOME/.config/iwb-updater.key}"
@@ -133,3 +137,6 @@ fi
echo "== 完成:https://download.maqiart.eu.org/updates/latest.json"
curl -s -m 15 https://download.maqiart.eu.org/updates/latest.json | head -c 200; echo
# 收尾再核一次:发布过程中若有人手改了产物层,这里会立刻暴露。
node scripts/check-plugins-sync.js || { echo '⚠ 收尾校验失败:插件两仓已不一致,请按 docs/standards/plugin-source-of-truth.md 回写源仓'; exit 1; }
+8 -1
View File
@@ -3,6 +3,10 @@
set -euo pipefail
cd "$(dirname "$0")/.."
# 插件两仓一致性(v3.26.109):桌面仓 plugins/ 必须等于插件源仓,否则发布的包/市场会和源码分叉。
# 源仓不存在时脚本自身会跳过(CI / 别人机器不阻塞)。见 docs/standards/plugin-source-of-truth.md。
node scripts/check-plugins-sync.js || { echo '✗ 插件两仓不一致,已停止发布(先同步插件源仓)'; exit 1; }
NAS_HOST="${NAS_HOST:-192.168.100.185}"
NAS_USER="${NAS_USER:-malongan}"
NAS_DIR="${NAS_DIR:-/vol8/web/iwb-download}"
@@ -73,4 +77,7 @@ SIZE2=$(curl -s -o /dev/null -m 120 -w '%{size_download}' "$PKG_URL") || SIZE2=0
PAGE_CODE=$(curl -s -o /dev/null -m 20 -w '%{http_code}' https://download.maqiart.eu.org/) || PAGE_CODE=000
echo " 页面 $PAGE_CODE 包 $CODE 远端 $SIZE2 B / 本地 $SIZE B"
if [ "$CODE" != "200" ] || [ "$SIZE2" != "$SIZE" ]; then echo "✗ 校验失败"; exit 1; fi
echo "✓ 发布完成:https://download.maqiart.eu.org/"
echo "✓ 发布完成:https://download.maqiart.eu.org/"
# 收尾再核一次:发布过程中若有人手改了产物层,这里会立刻暴露。
node scripts/check-plugins-sync.js || { echo '⚠ 收尾校验失败:插件两仓已不一致,请按 docs/standards/plugin-source-of-truth.md 回写源仓'; exit 1; }