mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-12 11:07:23 +00:00
fix: harden master auto deploy artifact delivery
This commit is contained in:
@@ -11,16 +11,18 @@
|
||||
服务器当前没有安装 `git` 和 `mvn`,因此自动部署链路采用:
|
||||
|
||||
1. GitHub Actions 在 `master` 合并后构建 `kkFileView-*.jar`
|
||||
2. 通过 WinRM 连接 Windows 服务器
|
||||
3. 由服务器从当前 workflow run 下载 jar artifact
|
||||
4. 备份线上 jar,替换为新版本
|
||||
5. 使用现有 `startup.bat` 重启,并做健康检查
|
||||
6. 如果健康检查失败,则自动回滚旧 jar 并重新拉起
|
||||
2. 由 GitHub Actions runner 解析当前 workflow artifact 的临时下载地址
|
||||
3. 通过 WinRM 连接 Windows 服务器
|
||||
4. 由服务器通过临时下载地址拉取 jar artifact
|
||||
5. 备份线上 jar,替换为新版本
|
||||
6. 使用现有 `startup.bat` 重启,并做健康检查
|
||||
7. 如果健康检查失败,则自动回滚旧 jar 并重新拉起
|
||||
|
||||
这样做的目的是不把 GitHub token 下发到生产服务器,服务器只接触一次性 artifact 下载链接。
|
||||
|
||||
## 需要配置的 GitHub Secrets
|
||||
|
||||
- `KK_DEPLOY_HOST`
|
||||
- `KK_DEPLOY_ARTIFACT_TOKEN`
|
||||
- `KK_DEPLOY_USERNAME`
|
||||
- `KK_DEPLOY_PASSWORD`
|
||||
|
||||
@@ -30,12 +32,10 @@
|
||||
- `KK_DEPLOY_ROOT=C:\kkFileView-5.0`
|
||||
- `KK_DEPLOY_HEALTH_URL=http://127.0.0.1:8012/`
|
||||
|
||||
其中 `KK_DEPLOY_ARTIFACT_TOKEN` 建议使用单独的细粒度 token,只授予当前仓库所需的最小读取权限,不要复用默认 `GITHUB_TOKEN` 到生产服务器。
|
||||
|
||||
## Workflow
|
||||
|
||||
新增 workflow:`.github/workflows/master-auto-deploy.yml`
|
||||
|
||||
- 触发条件:`push` 到 `master`,或手动 `workflow_dispatch`
|
||||
- 构建产物:`kkfileview-server-jar`
|
||||
- 部署方式:WinRM + GitHub Actions artifact 下载
|
||||
- 部署方式:WinRM + runner 侧解析 artifact 临时下载地址 + Windows 服务器拉取 artifact
|
||||
|
||||
Reference in New Issue
Block a user