ESP32 OTA update #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ESP32 OTA update | |
on: | |
# push: | |
# branches: | |
# - 'main' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Husarnet VPN | |
uses: husarnet/husarnet-action@v5 | |
with: | |
join-code: ${{ secrets.HUSARNET_JOINCODE }} | |
dashboard-login: ${{ secrets.HUSARNET_DASHBOARD_LOGIN }} | |
dashboard-password: ${{ secrets.HUSARNET_DASHBOARD_PASSWORD }} | |
- name: Wait until my-esp32 host is available | |
run: while ! grep -q "my-esp32" /etc/hosts; do sleep 1; done | |
- name: ESP32 software reset | |
run: curl -X POST 'http://my-esp32:8080/reset' | |
- name: Installing platformio | |
run: pip3 install -U platformio | |
- name: Building a firmware for ESP32 | |
run: | | |
export SSID=${{ secrets.WIFI_SSID }} | |
export PASS=${{ secrets.WIFI_PASS }} | |
export JOINCODE=${{ secrets.HUSARNET_JOINCODE }} | |
pio run | |
- name: Uploading a firmware to ESP32 | |
run: > | |
curl --http0.9 -# -v | |
-H 'Accept: */*' | |
-H 'Accept-Encoding: gzip, deflate' | |
-H 'Connection: keep-alive' | |
-F "MD5="$(md5sum "${{ github.workspace }}/.pio/build/esp32dev/firmware.bin" | cut -d ' ' -f 1)"" | |
-F 'firmware=@${{ github.workspace }}/.pio/build/esp32dev/firmware.bin' | |
'http://my-esp32:8080/update' | |