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