5 Commits

Author SHA1 Message Date
user
9234ff00de feat: Support HTTPS URLs for OTA updates
All checks were successful
Lint & Build / C/C++ Static Analysis (push) Successful in 35s
Lint & Build / Security Flaw Analysis (push) Successful in 19s
Lint & Build / Secret Scanning (push) Successful in 5s
Lint & Build / Shell Script Analysis (push) Successful in 7s
Lint & Build / Build Firmware (push) Successful in 2m18s
Lint & Build / Deploy to ESP Fleet (push) Successful in 3m32s
2026-02-05 13:57:08 +01:00
user
a1074319f2 ci: Upload firmware to Gitea releases for OTA
All checks were successful
Lint & Build / C/C++ Static Analysis (push) Successful in 35s
Lint & Build / Security Flaw Analysis (push) Successful in 19s
Lint & Build / Secret Scanning (push) Successful in 5s
Lint & Build / Shell Script Analysis (push) Successful in 7s
Lint & Build / Build Firmware (push) Successful in 2m17s
Lint & Build / Deploy to ESP Fleet (push) Successful in 3m29s
2026-02-05 13:48:08 +01:00
user
9ece83bac0 ci: Simplify deploy script to pure POSIX sh
All checks were successful
Lint & Build / C/C++ Static Analysis (push) Successful in 35s
Lint & Build / Security Flaw Analysis (push) Successful in 18s
Lint & Build / Secret Scanning (push) Successful in 5s
Lint & Build / Shell Script Analysis (push) Successful in 7s
Lint & Build / Build Firmware (push) Successful in 2m17s
Lint & Build / Deploy to ESP Fleet (push) Successful in 3m28s
2026-02-05 13:28:28 +01:00
user
cfa22e9e2a ci: Fix deploy script for POSIX sh, use explicit bash
Some checks failed
Lint & Build / C/C++ Static Analysis (push) Successful in 35s
Lint & Build / Security Flaw Analysis (push) Successful in 19s
Lint & Build / Secret Scanning (push) Successful in 5s
Lint & Build / Shell Script Analysis (push) Successful in 7s
Lint & Build / Build Firmware (push) Successful in 2m18s
Lint & Build / Deploy to ESP Fleet (push) Failing after 1m51s
2026-02-05 13:21:38 +01:00
user
baf2c69aee ci: Use hardcoded sensor IPs for deploy
Some checks failed
Lint & Build / C/C++ Static Analysis (push) Successful in 34s
Lint & Build / Security Flaw Analysis (push) Successful in 19s
Lint & Build / Secret Scanning (push) Successful in 5s
Lint & Build / Build Firmware (push) Successful in 2m17s
Lint & Build / Shell Script Analysis (push) Successful in 7s
Lint & Build / Deploy to ESP Fleet (push) Failing after 1m51s
2026-02-05 13:14:38 +01:00
2 changed files with 56 additions and 37 deletions

View File

@@ -56,11 +56,10 @@ jobs:
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
apt-get update && apt-get install -y --no-install-recommends netcat-openbsd curl jq
- name: Checkout
run: |
@@ -73,45 +72,65 @@ jobs:
cd get-started/csi_recv_router
idf.py build
- name: Create release and upload firmware
env:
GITEA_TOKEN: ${{ github.token }}
run: |
TAG="${{ github.ref_name }}"
REPO="${{ github.repository }}"
API_URL="https://git.mymx.me/api/v1"
echo "Creating release for tag: $TAG"
# Check if release exists
RELEASE=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"$API_URL/repos/$REPO/releases/tags/$TAG")
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id // empty')
if [ -z "$RELEASE_ID" ]; then
# Create new release
RELEASE=$(curl -s -X POST -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"body\": \"Automated release from CI\"}" \
"$API_URL/repos/$REPO/releases")
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id')
echo "Created release ID: $RELEASE_ID"
else
echo "Release exists with ID: $RELEASE_ID"
fi
# Upload firmware binary
echo "Uploading firmware..."
curl -s -X POST -H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@get-started/csi_recv_router/build/csi_recv_router.bin" \
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=csi_recv_router.bin"
# Store release URL for OTA
FIRMWARE_URL="https://git.mymx.me/$REPO/releases/download/$TAG/csi_recv_router.bin"
echo "Firmware URL: $FIRMWARE_URL"
echo "$FIRMWARE_URL" > /tmp/firmware_url.txt
- name: Deploy via OTA
run: |
SENSORS="muddy-storm amber-maple hollow-acorn"
PORT=8070
FIRMWARE_URL=$(cat /tmp/firmware_url.txt)
echo "Using firmware URL: $FIRMWARE_URL"
# Get host IP (first non-loopback IPv4)
HOST_IP=$(hostname -I | awk '{print $1}')
echo "Host IP: $HOST_IP"
# Deploy to muddy-storm
echo "=== Deploying to muddy-storm (192.168.129.29) ==="
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.29 5501 || true
sleep 30
# Start HTTP server in background
cd get-started/csi_recv_router/build
python3 -m http.server $PORT &
HTTP_PID=$!
sleep 2
# Deploy to amber-maple
echo "=== Deploying to amber-maple (192.168.129.30) ==="
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.30 5501 || true
sleep 30
# Deploy to each sensor
for sensor in $SENSORS; do
echo "=== Deploying to $sensor ==="
# Resolve mDNS hostname
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
fi
echo "Sensor IP: $SENSOR_IP"
# Deploy to hollow-acorn
echo "=== Deploying to hollow-acorn (192.168.129.31) ==="
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.31 5501 || true
sleep 30
# Send OTA command via UDP
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
sleep 30
done
# Cleanup
kill $HTTP_PID 2>/dev/null || true
echo "=== Deployment complete ==="
cppcheck:

View File

@@ -1750,8 +1750,8 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
/* OTA <url> */
if (strncmp(cmd, "OTA ", 4) == 0) {
const char *url = cmd + 4;
if (strncmp(url, "http://", 7) != 0) {
snprintf(reply, reply_size, "ERR OTA url must start with http://");
if (strncmp(url, "http://", 7) != 0 && strncmp(url, "https://", 8) != 0) {
snprintf(reply, reply_size, "ERR OTA url must start with http:// or https://");
return strlen(reply);
}
if (s_ota_in_progress) {