diff --git a/.github/workflows/dummy_priv_key.pem b/.github/workflows/dummy_priv_key.pem deleted file mode 100644 index e535136..0000000 --- a/.github/workflows/dummy_priv_key.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCUVCGRQOZBMk6F -+cMwcQ9g/JzZLWPd2VTAJOm4jrt0DsXlcBhG5u8Zkc+U33FcW9kD2aINxkfMUpCS -FfxmmOA1ONN0noZ3HatuIcYkswdsmJl92Uz5VX2kA8Fq6/GVx5nTo6Ip7WO9kyL9 -iuPfTbycSJ9thXjwRDUD2KaBDZFS3pe6NwhqEDpPvaw/EHBbHxEBS8GhftifhKEc -EUYwEepe6RKfyykVMQrFMhRAOikarKEuxs9LWCHB0wysy64dWuqiRBQTPlCm77mC -dJN9I8tPDhNn/AsrJRxAKTfeTZ4rEDCVEyOZTdxxpD2K9Ad46w/+olmoYnvdm/81 -C1Y7mWFIQL4PcIX9uiQ35rU9MJqA4BztGGTYkIVq0IIVI0cqgsh18RttEn7/AL4l -1NEGlTMLlXbrw2qonZr4+HTRRtKoRxG4LYXliuXoEOh43T4vh7TwAVG3DYhnBHCv -JuA3bV+NtTn8rIHEnkBhPpBPbyn8Y2PNRJGS7/XffESea3XuH0nNKHBpWycgrrtX -KqwQvtoy4IkClwhHkw2RjK840e2HoGsA1RUl1vDRNwklDbU8A1gZUGT+4zMO83to -NfYjjPsgvAUQOPuh6ajVVF+OSkZt8EzpgY3zoAymHqcfqUVim5Iv+9fZItQYBlqL -o29Pyc0e+P8+wCiT8rP5gjDnoZ5/hQIDAQABAoICABO6b48u6fEjTHJhWpFnguYh -czMnkwV/fILkkKQtcnKTQcWsd8N7v7LPmU5xvFV5GeTQiM9QNLMmYCLYrcNvnefg -8QRXzrFVJDyiXVpQPYfiHA2IXhvjlQcVlh+EgOitAva1PZevV/lvnSh1Kq3EByFk -6govxdAfIktVViq1WpjXu6fW3gBNZuloO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eAq1oReGuNv8hcyPC8Q -kr3x7MWDO9X9lfuZXd3yp41ZbGM8p1yMUjzeoOpAC1hLfTcaFU0UKK+gpXoZIrU6 -GmYhu3ZgTC9xGnl1pfiZvLTjLdac ------END PRIVATE KEY----- diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b8be3a9..da55a42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,6 @@ jobs: - name: Create header files run: | - cp "${GITHUB_WORKSPACE}/.github/workflows/dummy_priv_key.pem" "${GITHUB_WORKSPACE}/priv_key.pem" cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h" python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h" @@ -33,3 +32,4 @@ jobs: - name: Build PlatformIO Project (esp32-breadboard) run: pio run -e esp32-breadboard + diff --git a/.github/workflows/ota-release.yml b/.github/workflows/ota-release.yml index c37213e..39214f9 100644 --- a/.github/workflows/ota-release.yml +++ b/.github/workflows/ota-release.yml @@ -32,8 +32,8 @@ jobs: cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h" python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h" - - name: Build PlatformIO Project - run: pio run -e esp32-pcb + - name: Build signed firmware + run: pio run -t ota -e esp32-pcb - name: Upload signed firmware uses: djn24/add-asset-to-release@v1 diff --git a/build_hooks.py b/build_hooks.py index e6a4971..5abd1f6 100755 --- a/build_hooks.py +++ b/build_hooks.py @@ -1,16 +1,13 @@ Import("env") -env.AddPostAction( - "$BUILD_DIR/${PROGNAME}.bin", - env.VerboseAction( +env.AddCustomTarget( + name="ota", + dependencies="$BUILD_DIR/${PROGNAME}.bin", + actions=[ "openssl dgst -sha256 -sign priv_key.pem -keyform PEM -out $BUILD_DIR/${PROGNAME}.sig -binary $BUILD_DIR/${PROGNAME}.bin", - "Creating OTA signature...") -) - -env.AddPostAction( - "$BUILD_DIR/${PROGNAME}.bin", - env.VerboseAction( - "cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin", - "Creating ${PROGNAME}_signed.bin") + "cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin" + ], + title="OTA Signing", + description="Create a signed OTA update" ) diff --git a/platformio.ini b/platformio.ini index 0143d98..f9b91a0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -14,7 +14,7 @@ include_dir = noisemeter-device default_envs = esp32-pcb [env] -extra_scripts = post:build_hooks.py +extra_scripts = build_hooks.py framework = arduino platform = espressif32@6.1.0 board_build.partitions = nmpartitions.csv