File tree 2 files changed +20
-7
lines changed
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
203
203
function github_release_asset_delete(){ # github_release_asset_delete <repo-path> <release-asset-id>
204
204
local repo_path=" $1 "
205
205
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
208
211
}
209
212
210
213
Original file line number Diff line number Diff line change @@ -47,16 +47,22 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
47
47
fi
48
48
fi
49
49
50
+ sleep 5
50
51
echo " Creating asset '$LIBS_ZIP_FILENAME '..."
51
-
52
52
mv -f " dist/esp32-arduino-libs.zip" " dist/$LIBS_ZIP_FILENAME "
53
+
53
54
LIBS_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_ZIP_FILENAME " " dist/$LIBS_ZIP_FILENAME " `
54
55
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
57
62
fi
58
63
59
64
echo " Finished uploading asset '$LIBS_ZIP_FILENAME '. Asset ID: $LIBS_ASSET_ID "
65
+ sleep 5
60
66
61
67
# Calculate the local file checksum and size
62
68
local_checksum=$( sha256sum " dist/$LIBS_ZIP_FILENAME " | awk ' {print $1}' )
@@ -108,8 +114,12 @@ if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
108
114
109
115
JSON_ASSET_ID=` github_release_asset_upload " $AR_LIBS_REPO " " $LIBS_RELEASE_ID " " $LIBS_JSON_FILENAME " " $AR_OUT /package_esp32_index.template.json" `
110
116
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
113
123
fi
114
124
fi
115
125
You can’t perform that action at this time.
0 commit comments