From 866dc46182d3dfcba5d688a306d8b9c1b3071fc1 Mon Sep 17 00:00:00 2001 From: amt-cc Date: Thu, 26 Nov 2026 14:46:43 -0300 Subject: [PATCH] =?UTF-8?q?ci(backend):=20dispara=20deploy=20no=20Render?= =?UTF-8?q?=20ap=C3=B3s=20CI=20verde=20no=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/etl-ci.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/etl-ci.yml b/.github/workflows/etl-ci.yml index ab792e5..6aca0a5 100644 --- a/.github/workflows/etl-ci.yml +++ b/.github/workflows/etl-ci.yml @@ -130,3 +130,41 @@ jobs: - name: Run PostGIS integration tests run: pytest -m integration -v + + + deploy-backend: + name: Deploy backend (Render) + needs: [etl, infra, postgis-integration] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + env: + RENDER_DEPLOY_HOOK: ${{ secrets.RENDER_DEPLOY_HOOK }} + steps: + - name: Trigger Render deploy + shell: bash + run: | + if [[ -z "$RENDER_DEPLOY_HOOK" ]]; then + echo "::error::Missing GitHub Actions secret: RENDER_DEPLOY_HOOK" + exit 1 + fi + curl --fail --silent --show-error -X POST "$RENDER_DEPLOY_HOOK" + + - name: Wait for new version to be live + shell: bash + run: | + sleep 60 + for attempt in $(seq 1 30); do + status=$(curl -s -o /dev/null -w '%{http_code}' \ + "https://geobar-api.onrender.com/bars/nearby?lat=-19.9245&lng=-43.9352&radius=1500") + if [[ "$status" == "200" ]]; then + echo "API live: /bars/nearby -> 200" + exit 0 + fi + echo "Attempt $attempt: /bars/nearby -> $status, waiting..." + sleep 20 + done + echo "::error::API did not respond 200 after deploy" + exit 1 \ No newline at end of file