build: publish desktop installer via Gitea releases
Some checks failed
Build and tests / test (push) Has been cancelled

This commit is contained in:
237899745
2026-07-27 15:20:09 +08:00
parent f760aa0ae9
commit a736d70d57
12 changed files with 405 additions and 5 deletions

View File

@@ -2022,6 +2022,24 @@ download_project() {
echo ""
}
sync_desktop_release() {
local project_root="${1:-$PROJECT_DIR}"
local sync_script="${project_root}/frontend/scripts/sync-desktop-release.js"
print_step "同步桌面客户端 Release..."
if [[ ! -f "$sync_script" ]]; then
print_error "桌面安装包同步脚本不存在: $sync_script"
return 1
fi
if node "$sync_script"; then
print_success "桌面客户端 Release 已下载并通过校验"
else
print_error "桌面客户端 Release 同步失败,停止部署"
return 1
fi
echo ""
}
configure_admin_account() {
print_step "配置管理员账号"
echo ""
@@ -3539,6 +3557,13 @@ update_pull_latest_code() {
cp -a "$TEMP_BACKUP/frontend-downloads/." "/tmp/${PROJECT_NAME}-update/frontend/downloads/"
fi
if ! sync_desktop_release "/tmp/${PROJECT_NAME}-update"; then
if command -v pm2 &> /dev/null; then
pm2 restart ${PROJECT_NAME}-backend || true
fi
exit 1
fi
print_info "构建前端生产资源..."
cd "/tmp/${PROJECT_NAME}-update/frontend"
if ! npm ci --include=dev || ! npm run build; then
@@ -4230,6 +4255,9 @@ main() {
# 安装前端依赖并生成 dist
install_frontend_dependencies
# 从 Gitea Release 下载并校验桌面安装包
sync_desktop_release "$PROJECT_DIR"
# 创建配置文件
create_env_file