Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfa22e9e2a | ||
|
|
baf2c69aee | ||
|
|
7be795a26e |
@@ -54,46 +54,55 @@ jobs:
|
|||||||
runs-on: anvil
|
runs-on: anvil
|
||||||
needs: build
|
needs: build
|
||||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' || startsWith(github.ref, 'refs/tags/v')
|
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:
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends netcat-openbsd avahi-utils
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
git clone --depth=1 --branch=${{ github.ref_name }} \
|
||||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
||||||
|
|
||||||
- name: Rebuild firmware for deploy
|
- name: Build firmware
|
||||||
run: |
|
run: |
|
||||||
podman run --rm -v $(pwd):/project -w /project docker.io/espressif/idf:v5.3 \
|
. /opt/esp/idf/export.sh
|
||||||
bash -c ". /opt/esp/idf/export.sh && cd get-started/csi_recv_router && idf.py build"
|
cd get-started/csi_recv_router
|
||||||
|
idf.py build
|
||||||
|
|
||||||
- name: Deploy via OTA
|
- name: Deploy via OTA
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
FIRMWARE="$(pwd)/get-started/csi_recv_router/build/csi_recv_router.bin"
|
# Sensor IPs (update if DHCP changes)
|
||||||
SENSORS="muddy-storm amber-maple hollow-acorn"
|
SENSOR_NAMES="muddy-storm amber-maple hollow-acorn"
|
||||||
|
SENSOR_IPS="192.168.129.29 192.168.129.30 192.168.129.31"
|
||||||
PORT=8070
|
PORT=8070
|
||||||
|
|
||||||
# Get runner IP (first non-loopback IPv4)
|
# Get host IP - try multiple methods
|
||||||
RUNNER_IP=$(hostname -I | awk '{print $1}')
|
HOST_IP=$(ip route get 1 2>/dev/null | awk '{print $7; exit}')
|
||||||
echo "Runner IP: $RUNNER_IP"
|
if [ -z "$HOST_IP" ]; then
|
||||||
|
HOST_IP=$(hostname -I | awk '{print $1}')
|
||||||
|
fi
|
||||||
|
echo "Host IP: $HOST_IP"
|
||||||
|
|
||||||
# Start HTTP server in background
|
# Start HTTP server in background
|
||||||
cd get-started/csi_recv_router/build
|
cd get-started/csi_recv_router/build
|
||||||
python3 -m http.server $PORT &
|
python3 -m http.server $PORT --bind 0.0.0.0 &
|
||||||
HTTP_PID=$!
|
HTTP_PID=$!
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Deploy to each sensor
|
# Deploy to each sensor
|
||||||
for sensor in $SENSORS; do
|
set -- $SENSOR_IPS
|
||||||
echo "=== Deploying to $sensor ==="
|
for sensor in $SENSOR_NAMES; do
|
||||||
# Resolve mDNS hostname
|
SENSOR_IP="$1"
|
||||||
SENSOR_IP=$(getent hosts ${sensor}.local | awk '{print $1}' || avahi-resolve -n ${sensor}.local 2>/dev/null | awk '{print $2}')
|
shift
|
||||||
if [ -z "$SENSOR_IP" ]; then
|
echo "=== Deploying to $sensor ($SENSOR_IP) ==="
|
||||||
echo "Warning: Could not resolve $sensor.local, skipping"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "Sensor IP: $SENSOR_IP"
|
|
||||||
|
|
||||||
# Send OTA command via UDP
|
# 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"
|
echo "OTA command sent to $sensor"
|
||||||
|
|
||||||
# Wait for device to download and reboot
|
# Wait for device to download and reboot
|
||||||
|
|||||||
Reference in New Issue
Block a user