diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 719a469..f6158eb 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -54,26 +54,33 @@ jobs: runs-on: anvil needs: build if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' || startsWith(github.ref, 'refs/tags/v') + container: + image: docker.io/espressif/idf:v5.3 + options: --network host steps: + - name: Install tools + run: | + apt-get update && apt-get install -y --no-install-recommends netcat-openbsd avahi-utils + - name: Checkout run: | git clone --depth=1 --branch=${{ github.ref_name }} \ https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git . - - name: Rebuild firmware for deploy + - name: Build firmware run: | - podman run --rm -v $(pwd):/project -w /project docker.io/espressif/idf:v5.3 \ - bash -c ". /opt/esp/idf/export.sh && cd get-started/csi_recv_router && idf.py build" + . /opt/esp/idf/export.sh + cd get-started/csi_recv_router + idf.py build - name: Deploy via OTA run: | - FIRMWARE="$(pwd)/get-started/csi_recv_router/build/csi_recv_router.bin" SENSORS="muddy-storm amber-maple hollow-acorn" PORT=8070 - # Get runner IP (first non-loopback IPv4) - RUNNER_IP=$(hostname -I | awk '{print $1}') - echo "Runner IP: $RUNNER_IP" + # Get host IP (first non-loopback IPv4) + HOST_IP=$(hostname -I | awk '{print $1}') + echo "Host IP: $HOST_IP" # Start HTTP server in background cd get-started/csi_recv_router/build @@ -85,7 +92,10 @@ jobs: for sensor in $SENSORS; do echo "=== Deploying to $sensor ===" # Resolve mDNS hostname - SENSOR_IP=$(getent hosts ${sensor}.local | awk '{print $1}' || avahi-resolve -n ${sensor}.local 2>/dev/null | awk '{print $2}') + SENSOR_IP=$(getent hosts ${sensor}.local 2>/dev/null | awk '{print $1}') + if [ -z "$SENSOR_IP" ]; then + SENSOR_IP=$(avahi-resolve -4 -n ${sensor}.local 2>/dev/null | awk '{print $2}') + fi if [ -z "$SENSOR_IP" ]; then echo "Warning: Could not resolve $sensor.local, skipping" continue @@ -93,7 +103,7 @@ jobs: echo "Sensor IP: $SENSOR_IP" # Send OTA command via UDP - echo "OTA http://${RUNNER_IP}:${PORT}/csi_recv_router.bin" | nc -u -w 2 $SENSOR_IP 5501 + echo "OTA http://${HOST_IP}:${PORT}/csi_recv_router.bin" | nc -u -w 2 $SENSOR_IP 5501 echo "OTA command sent to $sensor" # Wait for device to download and reboot