Skip to content

Commit 0307c10

Browse files
committed
only sign firmware when necessary
1 parent 367c08a commit 0307c10

File tree

5 files changed

+12
-67
lines changed

5 files changed

+12
-67
lines changed

.github/workflows/dummy_priv_key.pem

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
2525
- name: Create header files
2626
run: |
27-
cp "${GITHUB_WORKSPACE}/.github/workflows/dummy_priv_key.pem" "${GITHUB_WORKSPACE}/priv_key.pem"
2827
cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h"
2928
python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h"
3029
@@ -33,3 +32,4 @@ jobs:
3332

3433
- name: Build PlatformIO Project (esp32-breadboard)
3534
run: pio run -e esp32-breadboard
35+

.github/workflows/ota-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h"
3333
python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h"
3434
35-
- name: Build PlatformIO Project
36-
run: pio run -e esp32-pcb
35+
- name: Build signed firmware
36+
run: pio run -t ota -e esp32-pcb
3737

3838
- name: Upload signed firmware
3939
uses: djn24/add-asset-to-release@v1

build_hooks.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
Import("env")
22

3-
env.AddPostAction(
4-
"$BUILD_DIR/${PROGNAME}.bin",
5-
env.VerboseAction(
3+
env.AddCustomTarget(
4+
name="ota",
5+
dependencies="$BUILD_DIR/${PROGNAME}.bin",
6+
actions=[
67
"openssl dgst -sha256 -sign priv_key.pem -keyform PEM -out $BUILD_DIR/${PROGNAME}.sig -binary $BUILD_DIR/${PROGNAME}.bin",
7-
"Creating OTA signature...")
8-
)
9-
10-
env.AddPostAction(
11-
"$BUILD_DIR/${PROGNAME}.bin",
12-
env.VerboseAction(
13-
"cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin",
14-
"Creating ${PROGNAME}_signed.bin")
8+
"cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin"
9+
],
10+
title="OTA Signing",
11+
description="Create a signed OTA update"
1512
)
1613

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include_dir = noisemeter-device
1414
default_envs = esp32-pcb
1515

1616
[env]
17-
extra_scripts = post:build_hooks.py
17+
extra_scripts = build_hooks.py
1818
framework = arduino
1919
2020
board_build.partitions = nmpartitions.csv

0 commit comments

Comments
 (0)