@@ -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,22 +184,30 @@ 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 -Rf " $GITHUB_WORKSPACE /tools/sdk" " $PKG_DIR /tools/"
189
- cp -f $GITHUB_WORKSPACE /tools/platformio-build* .py " $PKG_DIR /tools/"
187
+ cp -f " $GITHUB_WORKSPACE /tools/platformio-build.py" " $PKG_DIR /tools/"
190
188
191
189
# Remove unnecessary files in the package folder
192
190
echo " Cleaning up folders ..."
193
191
find " $PKG_DIR " -name ' *.DS_Store' -exec rm -f {} \;
194
192
find " $PKG_DIR " -name ' *.git*' -type f -delete
195
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
+
196
200
# Replace tools locations in platform.txt
197
201
echo " Generating platform.txt..."
198
202
cat " $GITHUB_WORKSPACE /platform.txt" | \
199
- sed " s/version=.*/version=$ver$extent /g" | \
203
+ sed " s/version=.*/version=$RELEASE_TAG /g" | \
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
- 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' | \
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' | \
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" | \
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' | \
204
211
sed ' s/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
205
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' | \
206
213
sed ' s/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \
@@ -239,6 +246,82 @@ echo "Package Uploaded"
239
246
echo " Download URL: $PACKAGE_URL "
240
247
echo
241
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'` # MacOS
316
+ RVTC_VERSION=` date -d " $RVTC_VERSION " ' +%y%m' `
317
+ rvtc_jq_arg=" \
318
+ (.packages[0].platforms[0].toolsDependencies[] | select(.name==\" $RVTC_NAME \" )).version = \" $RVTC_VERSION \" |\
319
+ (.packages[0].platforms[0].toolsDependencies[] | select(.name==\" $RVTC_NAME \" )).name = \" $RVTC_NEW_NAME \" |\
320
+ (.packages[0].tools[] | select(.name==\" $RVTC_NAME \" )).version = \" $RVTC_VERSION \" |\
321
+ (.packages[0].tools[] | select(.name==\" $RVTC_NAME \" )).name = \" $RVTC_NEW_NAME \" "
322
+ cat " $PACKAGE_JSON_TEMPLATE " | jq " $rvtc_jq_arg " > " $OUTPUT_DIR /package-$LIBS_PROJ_NAME -rvfix.json"
323
+ PACKAGE_JSON_TEMPLATE=" $OUTPUT_DIR /package-$LIBS_PROJ_NAME -rvfix.json"
324
+
242
325
# #
243
326
# # PACKAGE JSON
244
327
# #
@@ -266,21 +349,13 @@ if [ $? -ne 0 ]; then echo "ERROR: Get Releases Failed! ($?)"; exit 1; fi
266
349
set +e
267
350
prev_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
268
351
prev_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name" )
269
- 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" )
270
- 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" )
271
352
shopt -s nocasematch
272
353
if [ " $prev_release " == " $RELEASE_TAG " ]; then
273
354
prev_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
274
355
fi
275
356
if [ " $prev_any_release " == " $RELEASE_TAG " ]; then
276
357
prev_any_release=$( echo " $releasesJson " | jq -e -r " . | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name" )
277
358
fi
278
- if [ " $prev_branch_release " == " $RELEASE_TAG " ]; then
279
- 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" )
280
- fi
281
- if [ " $prev_branch_any_release " == " $RELEASE_TAG " ]; then
282
- 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" )
283
- fi
284
359
shopt -u nocasematch
285
360
set -e
286
361
@@ -313,97 +388,6 @@ if [ "$RELEASE_PRE" == "false" ]; then
313
388
echo
314
389
fi
315
390
316
- # #
317
- # # RELEASE NOTES
318
- # #
319
-
320
- # Create release notes
321
- echo " Preparing release notes ..."
322
- releaseNotes=" "
323
-
324
- # Process annotated tags
325
- relNotesRaw=` git -C " $GITHUB_WORKSPACE " show -s --format=%b $RELEASE_TAG `
326
- readarray -t msgArray <<< " $relNotesRaw"
327
- arrLen=${# msgArray[@]}
328
- if [ $arrLen > 3 ] && [ " ${msgArray[0]: 0: 3} " == " tag" ]; then
329
- ind=3
330
- while [ $ind -lt $arrLen ]; do
331
- if [ $ind -eq 3 ]; then
332
- releaseNotes=" #### ${msgArray[ind]} "
333
- releaseNotes+=$' \r\n '
334
- else
335
- oneLine=" $( echo -e " ${msgArray[ind]} " | sed -e ' s/^[[:space:]]*//' ) "
336
- if [ ${# oneLine} -gt 0 ]; then
337
- if [ " ${oneLine: 0: 2} " == " * " ]; then oneLine=$( echo ${oneLine/ \* / -} ) ; fi
338
- if [ " ${oneLine: 0: 2} " != " - " ]; then releaseNotes+=" - " ; fi
339
- releaseNotes+=" $oneLine "
340
- releaseNotes+=$' \r\n '
341
- fi
342
- fi
343
- let ind=$ind +1
344
- done
345
- fi
346
-
347
- # Append Commit Messages
348
- echo
349
- echo " Previous Branch Release: $prev_branch_release "
350
- echo " Previous Branch (any)release: $prev_branch_any_release "
351
- echo
352
- commitFile=" $OUTPUT_DIR /commits.txt"
353
- COMMITS_SINCE_RELEASE=" $prev_branch_any_release "
354
- if [ " $RELEASE_PRE " == " false" ]; then
355
- COMMITS_SINCE_RELEASE=" $prev_branch_release "
356
- fi
357
- if [ ! -z " $COMMITS_SINCE_RELEASE " ] && [ " $COMMITS_SINCE_RELEASE " != " null" ]; then
358
- echo " Getting commits since $COMMITS_SINCE_RELEASE ..."
359
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 " $COMMITS_SINCE_RELEASE ..HEAD" > " $commitFile "
360
- elif [ " $RELEASE_BRANCH " != " master" ]; then
361
- echo " Getting all commits on branch '$RELEASE_BRANCH ' ..."
362
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 --cherry-pick --left-only --no-merges HEAD...origin/master > " $commitFile "
363
- else
364
- echo " Getting all commits on master ..."
365
- git -C " $GITHUB_WORKSPACE " log --oneline -n 500 --no-merges > " $commitFile "
366
- fi
367
- releaseNotes+=$' \r\n ##### Commits\r\n '
368
- IFS=$' \n '
369
- for next in ` cat $commitFile `
370
- do
371
- IFS=' ' read -r commitId commitMsg <<< " $next"
372
- commitLine=" - [$commitId ](https://github.com/$GITHUB_REPOSITORY /commit/$commitId ) $commitMsg "
373
- releaseNotes+=" $commitLine "
374
- releaseNotes+=$' \r\n '
375
- done
376
- rm -f $commitFile
377
-
378
- # Prepend the original release body
379
- if [ " ${RELEASE_BODY: -1} " == $' \r ' ]; then
380
- RELEASE_BODY=" ${RELEASE_BODY: 0:- 1} "
381
- else
382
- RELEASE_BODY=" $RELEASE_BODY "
383
- fi
384
- RELEASE_BODY+=$' \r\n '
385
- releaseNotes=" $RELEASE_BODY$releaseNotes "
386
-
387
- # Update release page
388
- echo " Updating release notes ..."
389
- releaseNotes=$( printf ' %s' " $releaseNotes " | python -c ' import json,sys; print(json.dumps(sys.stdin.read()))' )
390
- releaseNotes=${releaseNotes: 1:- 1}
391
- curlData=" {\" body\" : \" $releaseNotes \" }"
392
- releaseData=` curl --data " $curlData " " https://api.github.com/repos/$GITHUB_REPOSITORY /releases/$RELEASE_ID ?access_token=$GITHUB_TOKEN " 2> /dev/null`
393
- if [ $? -ne 0 ]; then echo " ERROR: Updating Release Failed: $? " ; exit 1; fi
394
- echo " Release notes successfully updated"
395
- echo
396
-
397
- # #
398
- # # SUBMODULE VERSIONS
399
- # #
400
-
401
- # Upload submodules versions
402
- echo " Generating submodules.txt ..."
403
- git -C " $GITHUB_WORKSPACE " submodule status > " $OUTPUT_DIR /submodules.txt"
404
- echo " Uploading submodules.txt ..."
405
- echo " Download URL: " ` git_safe_upload_asset " $OUTPUT_DIR /submodules.txt" `
406
- echo " "
407
391
set +e
408
392
409
393
# #
0 commit comments