From 7cd5ba6933b0717f30cccdc6f61ce339c04637d2 Mon Sep 17 00:00:00 2001 From: golc <2483469113@qq.com> Date: Tue, 24 Feb 2026 13:23:58 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20CI/CD=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E6=9C=AC=E5=9C=B0=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 SSH 远程部署方式 - 改为本地直接执行 Docker 命令 - 优化健康检查等待时间 - 添加部署成功后的访问地址提示 Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yml | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 7561171..a6a4cce 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -55,40 +55,28 @@ jobs: runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' steps: - - name: 检出代码 - uses: actions/checkout@v3 + - name: 拉取最新代码 + run: | + cd /root/self_proj/oauth_nest_demo + git pull origin main || git pull origin master - - name: 下载构建产物 - uses: actions/download-artifact@v3 - with: - name: dist - path: dist/ - - - name: 部署到服务器 - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - port: ${{ secrets.SERVER_PORT || 22 }} - script: | - cd /root/self_proj/oauth_nest_demo - git pull origin main - cd /root/self_proj - docker-compose up -d --build backend - docker-compose ps + - name: 重新构建并启动后端容器 + run: | + cd /root/self_proj + docker-compose up -d --build backend - name: 健康检查 run: | echo "等待服务启动..." - sleep 10 - curl -f http://${{ secrets.SERVER_HOST }}:3000/api || exit 1 + sleep 15 + curl -f http://localhost:3000/api || exit 1 - name: 通知部署结果 if: always() run: | if [ ${{ job.status }} == 'success' ]; then echo "✅ 后端部署成功!" + echo "访问地址: https://tdapi.lcdd.net" else echo "❌ 后端部署失败!" fi