mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 21:50:44 +00:00
1.6.2:常规发布
- 版本号 1.6.2 -> 1.6.2 - 重建三端并打包 - 关键测试全过
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
r"""设备回来了:把 1.6.1 传到下载区,并部署最新 relay。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||||
sys.path.insert(0, str(ROOT / "_build"))
|
||||
|
||||
from devssh import run, upload # noqa: E402
|
||||
|
||||
VER = "1.6.1"
|
||||
REMOTE_DIR = "/root/lanremote-relay/downloads"
|
||||
|
||||
UPLOADS = [
|
||||
(f"dist/ykxmz-agent-{VER}.zip", f"{REMOTE_DIR}/ykxmz-agent-{VER}.zip"),
|
||||
(f"dist/ykxmz-server-{VER}.zip", f"{REMOTE_DIR}/ykxmz-server-{VER}.zip"),
|
||||
(f"dist/ykxmz-watch-{VER}.apk", f"{REMOTE_DIR}/ykxmz-watch-{VER}.apk"),
|
||||
]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
print("===== 1. 清掉旧版本 =====")
|
||||
_c, out, _e = run(f"ls {REMOTE_DIR}/ 2>/dev/null", timeout=30)
|
||||
for line in (out or "").splitlines():
|
||||
name = line.strip()
|
||||
if name and VER not in name:
|
||||
run(f"rm -f '{REMOTE_DIR}/{name}'", timeout=30)
|
||||
print(f" 删除 {name}")
|
||||
|
||||
print()
|
||||
print(f"===== 2. 上传 {VER} =====")
|
||||
for local, remote in UPLOADS:
|
||||
src = ROOT / local
|
||||
if not src.is_file():
|
||||
print(f" [失败] {local} 不存在")
|
||||
return 1
|
||||
upload(str(src), remote, 0o644)
|
||||
print(f" ✓ {src.name} ({src.stat().st_size / 1024 / 1024:.2f} MB)")
|
||||
|
||||
print()
|
||||
print("===== 3. 部署最新 relay.py / net-tune.sh =====")
|
||||
for local, remote in (("relay/relay.py", "/root/lanremote-relay/relay.py"),
|
||||
("relay/net-tune.sh",
|
||||
"/root/lanremote-relay/net-tune.sh"),
|
||||
("relay/watchdog.sh",
|
||||
"/root/lanremote-relay/watchdog.sh")):
|
||||
upload(str(ROOT / local), remote, 0o755)
|
||||
print(f" ✓ {Path(local).name}")
|
||||
run("systemctl restart lanremote-relay", timeout=90)
|
||||
print(" 已重启中转服务")
|
||||
|
||||
print()
|
||||
print("===== 4. 确认 =====")
|
||||
_c, out, _e = run(
|
||||
"sleep 4; echo ' 版本: '$(curl -s --max-time 8 "
|
||||
"http://127.0.0.1:8080/v1/health | head -c 100); "
|
||||
f"echo; ls -la {REMOTE_DIR}/ | tail -5", timeout=90)
|
||||
print(out)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user