@@ -78,43 +78,40 @@ jobs:
7878 python -m pip install --upgrade pip
7979 pip install --upgrade platformio
8080 - name : Build normal version
81+ run : |
82+ PLATFORMIO_BUILD_FLAGS='-DVERSION=\"v${{ steps.version.outputs.version }}\" -DDBG=0' pio run -d SmartEVSE-3/
83+ mkdir -p ./SmartEVSE-3/distribution
84+ - name : Sign normal version
85+ if : ${{ secrets.SECRET_RSA_KEY != '' }}
8186 env :
8287 super_secret : ${{ secrets.SECRET_RSA_KEY }}
8388 run : |
84- PLATFORMIO_BUILD_FLAGS='-DVERSION=\"v${{ steps.version.outputs.version }}\" -DDBG=0' pio run -d SmartEVSE-3/
85- # Create a temporary file
8689 secret_file=$(mktemp)
87- # Write the secret to the temporary file, because passing it as command line argument might reveal it for users using ps -a
8890 echo "$super_secret" > "$secret_file"
89- # Create signature file
9091 openssl dgst -sign "$secret_file" -keyform PEM -sha256 -out firmware.sign -binary ./SmartEVSE-3/.pio/build/release/firmware.bin
91- # throw it all in one file
9292 cat firmware.sign ./SmartEVSE-3/.pio/build/release/firmware.bin > ./SmartEVSE-3/.pio/build/release/firmware.signed.bin
93-
94- # save .bin files to directory because v4 upload-artifact@v4 can no longer add files to an existing artifact; so much for efficiency :-(
95- mkdir ./SmartEVSE-3/distribution
96- mv ./SmartEVSE-3/.pio/build/release/*.bin ./SmartEVSE-3/distribution
97-
98- # Remove the temporary file
9993 rm -f "$secret_file"
94+ - name : Collect normal build artifacts
95+ run : mv ./SmartEVSE-3/.pio/build/release/*.bin ./SmartEVSE-3/distribution
10096 - name : Build debug version
97+ run : |
98+ PLATFORMIO_BUILD_FLAGS='-DVERSION=\"v${{ steps.version.outputs.version }}\" -DDBG=1' pio run -d SmartEVSE-3/
99+ - name : Sign debug version
100+ if : ${{ secrets.SECRET_RSA_KEY != '' }}
101101 env :
102102 super_secret : ${{ secrets.SECRET_RSA_KEY }}
103103 run : |
104- PLATFORMIO_BUILD_FLAGS='-DVERSION=\"v${{ steps.version.outputs.version }}\" -DDBG=1' pio run -d SmartEVSE-3/
105- # Create a temporary file
106104 secret_file=$(mktemp)
107- # Write the secret to the temporary file, because passing it as command line argument might reveal it for users using ps -a
108105 echo "$super_secret" > "$secret_file"
109- # Create signature file
110106 openssl dgst -sign "$secret_file" -keyform PEM -sha256 -out firmware.sign -binary ./SmartEVSE-3/.pio/build/release/firmware.bin
111- # throw it all in one file
112107 cat firmware.sign ./SmartEVSE-3/.pio/build/release/firmware.bin > ./SmartEVSE-3/.pio/build/release/firmware.signed.bin
113- # Remove the temporary file
114108 rm -f "$secret_file"
109+ - name : Collect debug build artifacts
110+ run : |
115111 mv ./SmartEVSE-3/.pio/build/release/firmware.bin ./SmartEVSE-3/distribution/firmware.debug.bin
116- mv ./SmartEVSE-3/.pio/build/release/firmware.signed.bin ./SmartEVSE-3/distribution/firmware.debug.signed.bin
117- # prevent the .bin files are gathered in .pio directory in the dists-zip file:
112+ if [ -f ./SmartEVSE-3/.pio/build/release/firmware.signed.bin ]; then
113+ mv ./SmartEVSE-3/.pio/build/release/firmware.signed.bin ./SmartEVSE-3/distribution/firmware.debug.signed.bin
114+ fi
118115 cp -a ./SmartEVSE-3/HowToFlash.txt ./SmartEVSE-3/distribution
119116
120117 # Combined upload for all artifacts using v4
0 commit comments