From 6ad340ff88dd8ad5aba42c651b1dbd6f438fde81 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Sat, 7 Mar 2026 19:38:56 +0000 Subject: [PATCH] chore(ci): add Gitea Actions deploy workflow Deploys to 10.0.0.247 via SSH on push to main. Clones on first run, pulls on subsequent. Builds Docker image and runs docker compose up. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..4a95844 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Deploy to Docker + +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Deploy via SSH + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: 22 + script: | + set -e + APP_DIR="$HOME/mc-ai-bridge" + + # First run: clone. Subsequent: pull. + if [ ! -d "$APP_DIR/.git" ]; then + git clone https://git.silverlabs.uk/SilverLABS/mc-ai-bridge.git "$APP_DIR" + else + cd "$APP_DIR" + git fetch origin main + git reset --hard origin/main + fi + + cd "$APP_DIR" + + # Build and deploy + docker compose down --remove-orphans || true + docker compose build --no-cache + docker compose up -d + + # Verify container is running + sleep 5 + docker compose ps + echo "--- Health check ---" + curl -sf http://localhost:3002/health || echo "Health check not yet available (container may still be starting)"