Added a workflow to let the agent automatically deploy frontend onto the esp32.

This commit is contained in:
2026-03-08 15:19:17 -04:00
parent 9388bf17af
commit 56acf92f75
10 changed files with 240 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
---
description: Build, package, and deploy frontend updates via OTA
---
This workflow automates the process of building the frontend, packaging it into a LittleFS binary, and uploading it to the ESP32 device.
> [!IMPORTANT]
> Ensure `VITE_API_BASE` in `frontend/.env` is set to the target device's IP address.
### Steps
1. **Build and Package Frontend**
Run the following command in the `frontend/` directory to build the production assets and create the versioned `.bin` file:
```bash
npm run build:esp32 && npm run ota:package
```
2. **Deploy Update**
Run the deployment script to upload the latest version to the device:
```bash
npm run ota:deploy
```
3. **Verify Update**
Wait for the device to reboot and verify the changes on the dashboard.
---
### Universal Bundle Option
If you also need to update the firmware, use the universal bundle workflow:
1. **Build Firmware**
From the project root:
```bash
idf.py build
```
2. **Create Bundle**
In the `frontend/` directory:
```bash
npm run ota:bundle
```
3. **Deploy Bundle**
In the `frontend/` directory:
```bash
npm run ota:deploy-bundle
```