@@ -23,7 +23,6 @@ RELEASE_PRE=`echo $EVENT_JSON | jq -r '.release.prerelease'`
23
23
RELEASE_TAG=` echo $EVENT_JSON | jq -r ' .release.tag_name' `
24
24
RELEASE_BRANCH=` echo $EVENT_JSON | jq -r ' .release.target_commitish' `
25
25
RELEASE_ID=` echo $EVENT_JSON | jq -r ' .release.id' `
26
- RELEASE_BODY=` echo $EVENT_JSON | jq -r ' .release.body' `
27
26
28
27
OUTPUT_DIR=" $GITHUB_WORKSPACE /build"
29
28
PACKAGE_NAME=" esp32-$RELEASE_TAG "
@@ -185,23 +184,29 @@ cp -f "$GITHUB_WORKSPACE/tools/gen_insights_package.py" "$PKG_DIR/tools/"
185
184
cp -f " $GITHUB_WORKSPACE /tools/gen_insights_package.exe" " $PKG_DIR /tools/"
186
185
cp -Rf " $GITHUB_WORKSPACE /tools/partitions" " $PKG_DIR /tools/"
187
186
cp -Rf " $GITHUB_WORKSPACE /tools/ide-debug" " $PKG_DIR /tools/"
188
- cp -f $GITHUB_WORKSPACE /tools/platformio-build* .py " $PKG_DIR /tools/"
187
+ cp -f " $GITHUB_WORKSPACE /tools/platformio-build.py" " $PKG_DIR /tools/"
189
188
190
189
# Remove unnecessary files in the package folder
191
190
echo " Cleaning up folders ..."
192
191
find " $PKG_DIR " -name ' *.DS_Store' -exec rm -f {} \;
193
192
find " $PKG_DIR " -name ' *.git*' -type f -delete
194
193
194
+ # #
195
+ # # TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
196
+ # #
197
+ RVTC_NAME=" riscv32-esp-elf-gcc"
198
+ RVTC_NEW_NAME=" esp-rv32"
199
+
195
200
# Replace tools locations in platform.txt
196
201
echo " Generating platform.txt..."
197
202
cat " $GITHUB_WORKSPACE /platform.txt" | \
198
- sed " s/version=.*/version=$ver$extent /g" | \
203
+ sed " s/version=.*/version=$RELEASE_TAG /g" | \
199
204
sed ' s/tools.esp32-arduino-libs.path={runtime.platform.path}\/tools\/esp32-arduino-libs/tools.esp32-arduino-libs.path=\{runtime.tools.esp32-arduino-libs.path\}/g' | \
200
205
sed ' s/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
201
206
sed ' s/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
202
207
sed ' s/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
203
208
sed ' s/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
204
- sed ' s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc .path\}/g' | \
209
+ sed " s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\\ /tools\\ /riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\\ {runtime.tools.$RVTC_NEW_NAME .path\\ }/g" | \
205
210
sed ' s/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
206
211
sed ' s/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
207
212
sed ' s/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
@@ -241,6 +246,81 @@ echo "Package Uploaded"
241
246
echo " Download URL: $PACKAGE_URL "
242
247
echo
243
248
249
+ # #
250
+ # # LIBS PACKAGE ZIP
251
+ # #
252
+
253
+ LIBS_PROJ_NAME=" esp32-arduino-libs"
254
+ LIBS_PKG_DIR=" $OUTPUT_DIR /$LIBS_PROJ_NAME "
255
+ LIBS_PACKAGE_ZIP=" $LIBS_PROJ_NAME -$RELEASE_TAG .zip"
256
+
257
+ # Get the libs package URL from the template
258
+ LIBS_PACKAGE_SRC_ZIP=" $OUTPUT_DIR /src-$LIBS_PROJ_NAME .zip"
259
+ LIBS_PACKAGE_SRC_URL=` cat $PACKAGE_JSON_TEMPLATE | jq -r " .packages[0].tools[] | select(.name==\" $LIBS_PROJ_NAME \" ) | .systems[0].url" `
260
+
261
+ # Download the libs package
262
+ echo " Downloading the libs archive ..."
263
+ curl -o " $LIBS_PACKAGE_SRC_ZIP " -LJO --url " $LIBS_PACKAGE_SRC_URL " || exit 1
264
+
265
+ # Extract the libs package
266
+ echo " Extracting the archive ..."
267
+ unzip -q -d " $OUTPUT_DIR " " $LIBS_PACKAGE_SRC_ZIP " || exit 1
268
+ EXTRACTED_DIR=` ls " $OUTPUT_DIR " | grep " ^$LIBS_PROJ_NAME " `
269
+ mv " $OUTPUT_DIR /$EXTRACTED_DIR " " $LIBS_PKG_DIR " || exit 1
270
+
271
+ # Remove unnecessary files in the package folder
272
+ echo " Cleaning up folders ..."
273
+ find " $LIBS_PKG_DIR " -name ' *.DS_Store' -exec rm -f {} \;
274
+ find " $LIBS_PKG_DIR " -name ' *.git*' -type f -delete
275
+
276
+ # Compress package folder
277
+ echo " Creating ZIP ..."
278
+ pushd " $OUTPUT_DIR " > /dev/null
279
+ zip -qr " $LIBS_PACKAGE_ZIP " " $LIBS_PROJ_NAME "
280
+ if [ $? -ne 0 ]; then echo " ERROR: Failed to create $LIBS_PACKAGE_ZIP ($? )" ; exit 1; fi
281
+
282
+ # Calculate SHA-256
283
+ echo " Calculating SHA sum ..."
284
+ LIBS_PACKAGE_PATH=" $OUTPUT_DIR /$LIBS_PACKAGE_ZIP "
285
+ LIBS_PACKAGE_SHA=` shasum -a 256 " $LIBS_PACKAGE_ZIP " | cut -f 1 -d ' ' `
286
+ LIBS_PACKAGE_SIZE=` get_file_size " $LIBS_PACKAGE_ZIP " `
287
+ popd > /dev/null
288
+ rm -rf " $LIBS_PKG_DIR "
289
+ echo " '$LIBS_PACKAGE_ZIP ' Created! Size: $LIBS_PACKAGE_SIZE , SHA-256: $LIBS_PACKAGE_SHA "
290
+ echo
291
+
292
+ # Upload package to release page
293
+ echo " Uploading libs package to release page ..."
294
+ LIBS_PACKAGE_URL=` git_safe_upload_asset " $LIBS_PACKAGE_PATH " `
295
+ echo " Libs Package Uploaded"
296
+ echo " Libs Download URL: $LIBS_PACKAGE_URL "
297
+ echo
298
+
299
+ # Construct JQ argument with libs package data
300
+ libs_jq_arg=" \
301
+ (.packages[0].tools[] | select(.name==\" $LIBS_PROJ_NAME \" )).systems[].url = \" $LIBS_PACKAGE_URL \" |\
302
+ (.packages[0].tools[] | select(.name==\" $LIBS_PROJ_NAME \" )).systems[].archiveFileName = \" $LIBS_PACKAGE_ZIP \" |\
303
+ (.packages[0].tools[] | select(.name==\" $LIBS_PROJ_NAME \" )).systems[].size = \" $LIBS_PACKAGE_SIZE \" |\
304
+ (.packages[0].tools[] | select(.name==\" $LIBS_PROJ_NAME \" )).systems[].checksum = \" SHA-256:$LIBS_PACKAGE_SHA \" "
305
+
306
+ # Update template values for the libs package and store it in the build folder
307
+ cat " $PACKAGE_JSON_TEMPLATE " | jq " $libs_jq_arg " > " $OUTPUT_DIR /package-$LIBS_PROJ_NAME .json"
308
+ # Overwrite the template location with the newly edited one
309
+ PACKAGE_JSON_TEMPLATE=" $OUTPUT_DIR /package-$LIBS_PROJ_NAME .json"
310
+
311
+ # #
312
+ # # TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
313
+ # #
314
+ RVTC_VERSION=` cat $PACKAGE_JSON_TEMPLATE | jq -r " .packages[0].platforms[0].toolsDependencies[] | select(.name == \" $RVTC_NAME \" ) | .version" | cut -d ' _' -f 2`
315
+ RVTC_VERSION=` date -j -f ' %Y%m%d' " $RVTC_VERSION " ' +%y%m' `
316
+ rvtc_jq_arg=" \
317
+ (.packages[0].platforms[0].toolsDependencies[] | select(.name==\" $RVTC_NAME \" )).version = \" $RVTC_VERSION \" |\
318
+ (.packages[0].platforms[0].toolsDependencies[] | select(.name==\" $RVTC_NAME \" )).name = \" $RVTC_NEW_NAME \" |\
319
+ (.packages[0].tools[] | select(.name==\" $RVTC_NAME \" )).version = \" $RVTC_VERSION \" |\
320
+ (.packages[0].tools[] | select(.name==\" $RVTC_NAME \" )).name = \" $RVTC_NEW_NAME \" "
321
+ cat " $PACKAGE_JSON_TEMPLATE " | jq " $rvtc_jq_arg " > " $OUTPUT_DIR /package-$LIBS_PROJ_NAME -rvfix.json"
322
+ PACKAGE_JSON_TEMPLATE=" $OUTPUT_DIR /package-$LIBS_PROJ_NAME -rvfix.json"
323
+
244
324
# #
245
325
# # PACKAGE JSON
246
326
# #
@@ -268,21 +348,13 @@ if [ $? -ne 0 ]; then echo "ERROR: Get Releases Failed! ($?)"; exit 1; fi
268
348
set +e
269
349
prev_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
270
350
prev_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
271
- prev_branch_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false and .target_commitish == \" $RELEASE_BRANCH \" )) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
272
- prev_branch_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .target_commitish == \" $RELEASE_BRANCH \" )) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
273
351
shopt -s nocasematch
274
352
if [ " $prev_release " == " $RELEASE_TAG " ]; then
275
353
prev_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
276
354
fi
277
355
if [ " $prev_any_release " == " $RELEASE_TAG " ]; then
278
356
prev_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
279
357
fi
280
- if [ " $prev_branch_release " == " $RELEASE_TAG " ]; then
281
- prev_branch_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false and .target_commitish == \" $RELEASE_BRANCH \" )) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
282
- fi
283
- if [ " $prev_branch_any_release " == " $RELEASE_TAG " ]; then
284
- prev_branch_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .target_commitish == \" $RELEASE_BRANCH \" )) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
285
- fi
286
358
shopt -u nocasematch
287
359
set -e
288
360
@@ -315,97 +387,6 @@ if [ "$RELEASE_PRE" == "false" ]; then
315
387
echo
316
388
fi
317
389
318
- # #
319
- # # RELEASE NOTES
320
- # #
321
-
322
- # Create release notes
323
- echo " Preparing release notes ..."
324
- releaseNotes=" "
325
-
326
- # Process annotated tags
327
- relNotesRaw=` git -C " $GITHUB_WORKSPACE " show -s --format=%b $RELEASE_TAG `
328
- readarray -t msgArray <<< " $relNotesRaw"
329
- arrLen=${# msgArray[@]}
330
- if [ $arrLen > 3 ] && [ " ${msgArray[0]: 0: 3} " == " tag" ]; then
331
- ind=3
332
- while [ $ind -lt $arrLen ]; do
333
- if [ $ind -eq 3 ]; then
334
- releaseNotes=" #### ${msgArray[ind]} "
335
- releaseNotes+=$' \r\n '
336
- else
337
- oneLine=" $( echo -e " ${msgArray[ind]} " | sed -e ' s/^[[:space:]]*//' ) "
338
- if [ ${# oneLine} -gt 0 ]; then
339
- if [ " ${oneLine: 0: 2} " == " * " ]; then oneLine=$( echo ${oneLine/ \* / -} ) ; fi
340
- if [ " ${oneLine: 0: 2} " != " - " ]; then releaseNotes+=" - " ; fi
341
- releaseNotes+=" $oneLine "
342
- releaseNotes+=$' \r\n '
343
- fi
344
- fi
345
- let ind=$ind +1
346
- done
347
- fi
348
-
349
- # Append Commit Messages
350
- echo
351
- echo " Previous Branch Release: $prev_branch_release "
352
- echo " Previous Branch (any)release: $prev_branch_any_release "
353
- echo
354
- commitFile=" $OUTPUT_DIR /commits.txt"
355
- COMMITS_SINCE_RELEASE=" $prev_branch_any_release "
356
- if [ " $RELEASE_PRE " == " false" ]; then
357
- COMMITS_SINCE_RELEASE=" $prev_branch_release "
358
- fi
359
- if [ ! -z " $COMMITS_SINCE_RELEASE " ] && [ " $COMMITS_SINCE_RELEASE " != " null" ]; then
360
- echo " Getting commits since $COMMITS_SINCE_RELEASE ..."
361
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 " $COMMITS_SINCE_RELEASE ..HEAD" > " $commitFile "
362
- elif [ " $RELEASE_BRANCH " != " master" ]; then
363
- echo " Getting all commits on branch '$RELEASE_BRANCH ' ..."
364
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 --cherry-pick --left-only --no-merges HEAD...origin/master > " $commitFile "
365
- else
366
- echo " Getting all commits on master ..."
367
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 --no-merges > " $commitFile "
368
- fi
369
- releaseNotes+=$' \r\n ##### Commits\r\n '
370
- IFS=$' \n '
371
- for next in ` cat $commitFile `
372
- do
373
- IFS=' ' read -r commitId commitMsg <<< " $next"
374
- commitLine=" - [$commitId ](https://github.com/$GITHUB_REPOSITORY /commit/$commitId ) $commitMsg "
375
- releaseNotes+=" $commitLine "
376
- releaseNotes+=$' \r\n '
377
- done
378
- rm -f $commitFile
379
-
380
- # Prepend the original release body
381
- if [ " ${RELEASE_BODY: -1} " == $' \r ' ]; then
382
- RELEASE_BODY=" ${RELEASE_BODY: 0:- 1} "
383
- else
384
- RELEASE_BODY=" $RELEASE_BODY "
385
- fi
386
- RELEASE_BODY+=$' \r\n '
387
- releaseNotes=" $RELEASE_BODY$releaseNotes "
388
-
389
- # Update release page
390
- echo " Updating release notes ..."
391
- releaseNotes=$( printf ' %s' " $releaseNotes " | python -c ' import json,sys; print(json.dumps(sys.stdin.read()))' )
392
- releaseNotes=${releaseNotes: 1:- 1}
393
- curlData=" {\" body\" : \" $releaseNotes \" }"
394
- releaseData=` curl --data " $curlData " " https://api.github.com/repos/$GITHUB_REPOSITORY /releases/$RELEASE_ID ?access_token=$GITHUB_TOKEN " 2> /dev/null`
395
- if [ $? -ne 0 ]; then echo " ERROR: Updating Release Failed: $? " ; exit 1; fi
396
- echo " Release notes successfully updated"
397
- echo
398
-
399
- # #
400
- # # SUBMODULE VERSIONS
401
- # #
402
-
403
- # Upload submodules versions
404
- echo " Generating submodules.txt ..."
405
- git -C " $GITHUB_WORKSPACE " submodule status > " $OUTPUT_DIR /submodules.txt"
406
- echo " Uploading submodules.txt ..."
407
- echo " Download URL: " ` git_safe_upload_asset " $OUTPUT_DIR /submodules.txt" `
408
- echo " "
409
390
set +e
410
391
411
392
# #
0 commit comments