File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -203,8 +203,11 @@ function github_release_asset_upload(){ # github_release_asset_upload <repo-path
203203function github_release_asset_delete(){ # github_release_asset_delete <repo-path> <release-asset-id>
204204 local repo_path=" $1 "
205205 local release_asset_id=" $2 "
206- local res=$( curl -s -k -o /dev/null -w " %{http_code}" -X DELETE -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$repo_path /releases/assets/$release_asset_id " )
207- if [ " $res " -eq 204 ]; then echo 1; else echo 0; fi
206+ local res
207+ local return_code
208+ res=$( curl -s -k -o /dev/null -w " %{http_code}" -X DELETE -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$repo_path /releases/assets/$release_asset_id " )
209+ return_code=$?
210+ if [ " $res " -eq 204 ] && [ " $return_code " -eq 0 ] ; then echo 1; else echo 0; fi
208211}
209212
210213
Original file line number Diff line number Diff line change @@ -47,16 +47,22 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
4747 fi
4848 fi
4949
50+ sleep 5
5051 echo " Creating asset '$LIBS_ZIP_FILENAME '..."
51-
5252 mv -f " dist/esp32-arduino-libs.zip" " dist/$LIBS_ZIP_FILENAME "
53+
5354 LIBS_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_ZIP_FILENAME " " dist/$LIBS_ZIP_FILENAME " `
5455 if [ -z " $LIBS_ASSET_ID " ]; then
55- echo " ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME '"
56- exit 1
56+ echo " ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME . Retrying..."
57+ LIBS_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_ZIP_FILENAME " " dist/$LIBS_ZIP_FILENAME " `
58+ if [ -z " $LIBS_ASSET_ID " ]; then
59+ echo " ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME '"
60+ exit 1
61+ fi
5762 fi
5863
5964 echo " Finished uploading asset '$LIBS_ZIP_FILENAME '. Asset ID: $LIBS_ASSET_ID "
65+ sleep 5
6066
6167 # Calculate the local file checksum and size
6268 local_checksum=$( sha256sum " dist/$LIBS_ZIP_FILENAME " | awk ' {print $1}' )
@@ -108,8 +114,12 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
108114
109115 JSON_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_JSON_FILENAME " " $AR_OUT /package_esp32_index.template.json" `
110116 if [ -z " $JSON_ASSET_ID " ]; then
111- echo " ERROR: Failed to upload asset '$LIBS_JSON_FILENAME '"
112- exit 1
117+ echo " ERROR: Failed to upload asset '$LIBS_JSON_FILENAME '. Retrying..."
118+ JSON_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_JSON_FILENAME " " $AR_OUT /package_esp32_index.template.json" `
119+ if [ -z " $JSON_ASSET_ID " ]; then
120+ echo " ERROR: Failed to upload asset '$LIBS_JSON_FILENAME '"
121+ exit 1
122+ fi
113123 fi
114124fi
115125
You can’t perform that action at this time.
0 commit comments