feat: 更新 CI/CD 配置为本地部署
Backend CI/CD / build (push) Failing after 44s Details
Backend CI/CD / deploy (push) Has been skipped Details

- 移除 SSH 远程部署方式
- 改为本地直接执行 Docker 命令
- 优化健康检查等待时间
- 添加部署成功后的访问地址提示

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
golc 2026-02-24 13:23:58 +00:00
parent 65a8c53176
commit 7cd5ba6933
1 changed files with 11 additions and 23 deletions

View File

@ -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