feat(deploy): 优化部署脚本,添加 dry-run、备份、SSH 复用

This commit is contained in:
2026-04-19 00:20:06 +08:00
parent 9d452c4e75
commit 44aa62da49
3 changed files with 324 additions and 64 deletions

View File

@@ -336,10 +336,26 @@ let new_expires = base_time + days(pkg_days);
```bash
./deploy.sh development # 部署到测试服务器
./deploy.sh production # 部署到生产服务器
./deploy.sh production # 部署到生产服务器
```
**deploy.sh 功能**:依赖检查 → 编译 → 上传二进制/配置 → 重启服务 → 部署后测试
**deploy.sh 选项:**
| 选项 | 说明 |
|------|------|
| `--dry-run` | 预览模式,不执行实际操作 |
| `--yes, -y` | 跳过确认提示 |
| `--skip-tests` | 跳过部署后测试 |
| `--help, -h` | 显示帮助信息 |
**示例:**
```bash
./deploy.sh production --dry-run # 预览生产部署
./deploy.sh production --yes # 无需确认直接部署
./deploy.sh development --skip-tests # 跳过测试
```
**deploy.sh 功能**:依赖检查 → 编译 → 备份旧版本 → 上传二进制/配置 → 重启服务 → 部署后测试
### 前端部署