fix: 依赖拉取
Some checks failed
JT808 CI/CD / build-and-deploy (push) Has been cancelled

This commit is contained in:
lzh
2025-12-12 15:18:41 +08:00
parent 1cbc4a04e9
commit 6bb6cc4b4c
2 changed files with 15 additions and 13 deletions

View File

@@ -11,7 +11,7 @@
- Java 17 + Maven用于构建
- Docker CLI + `docker buildx` (用于构建、推送镜像)。
- Git 和网络访问拉取仓库、推送镜像、SSH 连接目标服务器)。
2. **Secrets 配置**:在 Gitea 仓库的 “Settings → Secrets” 下新增:
2. **Secrets 配置**:在 Gitea 仓库的 “Settings → Secrets” 下新增(若希望整个组织复用,可在组织层级配置,仓库内可以覆盖同名 Key
- `REGISTRY_URL`:镜像仓库域名,例如 `registry.example.com`
- `REGISTRY_USERNAME` / `REGISTRY_PASSWORD`:镜像仓库凭据;若 Registry 允许匿名访问,可留空,本 workflow 会自动跳过登录步骤。
- `IMAGE_NAME`:镜像名称,默认为 `jt808-server`
@@ -30,16 +30,18 @@ on:
- main
```
> Gitea Actions 使用 `uses: https://github.com/...` 语法来引用 GitHub 上已有的 Action因此 workflow 中的 Action 即使不是 Gitea 官方的也能被 Runner 下载与执行。
- **构建阶段**
- `actions/checkout@v4` 拉取代码。
- `actions/setup-java@v4` 配置 Temurin JDK 17。
- `https://github.com/actions/checkout@v4` 拉取代码。
- `https://github.com/actions/setup-java@v4` 配置 Temurin JDK 17。
- 使用 `mvn -B clean package -DskipTests` 生成可执行 Jar。
- **镜像阶段**
- `docker/setup-buildx-action@v3` 准备多平台构建环境。
- `docker/login-action@v3` 登陆私有仓库。
- `docker/build-push-action@v5` 构建 Docker 镜像并推送:标签格式 `${REGISTRY_URL}/${IMAGE_NAME}:${short-commit}`,通过 `git rev-parse --short HEAD` 动态生成。
- `https://github.com/docker/setup-buildx-action@v3` 准备多平台构建环境。
- `https://github.com/docker/login-action@v3` 登陆私有仓库(如配置了 `REGISTRY_USERNAME/PASSWORD`
- `https://github.com/docker/build-push-action@v5` 构建 Docker 镜像并推送:标签格式 `${REGISTRY_URL}/${IMAGE_NAME}:${short-commit}`,通过 `git rev-parse --short HEAD` 动态生成。
- **部署阶段**
- `appleboy/ssh-action@v0.1.5` 登录目标主机,执行 `docker pull`、`docker stop`、`docker rm`、`docker run` 的操作,始终以 `jt808-server` 名称运行容器并暴露 `8080`/`20048`。
- `https://github.com/appleboy/ssh-action@v0.1.5` 登录目标主机,执行 `docker pull`、`docker stop`、`docker rm`、`docker run` 的操作,始终以 `jt808-server` 名称运行容器并暴露 `8080`/`20048`。
## 目标服务器要求