diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..903c003 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,60 @@ +name: Deploy Research Workbench + +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Pull latest code + working-directory: /home/ken/workspace/research-workbench + run: | + git pull origin main + + - name: Build frontend + working-directory: /home/ken/workspace/research-workbench/frontend + run: | + npm ci + npm run build + + - name: Stop old containers + working-directory: /home/ken/workspace/research-workbench + run: | + # Stop the old car-help container if still running + docker rm -f car-help 2>/dev/null || true + # Stop any existing workbench container + docker compose down 2>/dev/null || true + + - name: Build and start container + working-directory: /home/ken/workspace/research-workbench + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + AUTH_USER: ${{ secrets.AUTH_USER }} + AUTH_PASS_HASH: ${{ secrets.AUTH_PASS_HASH }} + run: | + docker compose up --build -d + + - name: Wait for healthy + run: | + echo "Waiting for container to start..." + for i in $(seq 1 60); do + if curl -sf http://localhost:8080/ > /dev/null 2>&1; then + echo "App is up at http://localhost:8080/" + exit 0 + fi + sleep 2 + done + echo "ERROR: App did not respond within 120s" + docker compose -f /home/ken/workspace/research-workbench/docker-compose.yml logs --tail=50 + exit 1 + + - name: Verify new UI is served + run: | + BODY=$(curl -sf http://localhost:8080/ || echo "FETCH_FAILED") + if echo "$BODY" | grep -qi "car-help"; then + echo "ERROR: Still serving old car-help UI!" + exit 1 + fi + echo "Deploy successful - new UI is live at https://research.ampbox.io"