name: Deploy to Server on: [push] jobs: deploy: runs-on: ubuntu steps: - name: Checkout code run: | git config --global http.version HTTP/1.1 git clone --depth=1 https://sdd:zsj981107@gitea.tangledup-ai.com/quant-speed-AI/Scoring-System.git /tmp/scoring-deploy - name: Install sshpass run: apt-get install -y sshpass rsync - name: Copy code to server run: | sshpass -p "123quant-speed" rsync -avz --delete \ --exclude='.git' \ --exclude='backend/.env' \ --exclude='backend/media/' \ -e "ssh -o StrictHostKeyChecking=no" \ /tmp/scoring-deploy/ quant@6.6.6.66:/home/quant/data/dev/deploy/ - name: Deploy on server via SSH uses: https://gitea.com/actions/appleboy-ssh-action@v1.0.3 with: host: 6.6.6.66 username: quant password: 123quant-speed script: | TARGET_DIR="/home/quant/data/dev/deploy" SUDO_PASSWORD="123quant-speed" cd $TARGET_DIR # 1. 停止并移除 Docker 容器 echo "===== 停止并清理 Docker =====" echo $SUDO_PASSWORD | sudo -S docker compose down # 2. 创建/更新 .env 文件 echo "===== 配置环境变量 =====" cat > backend/.env <