Skip to content

Commit 517ae97

Browse files
author
Travis CI
committed
setup upload validation
1 parent f8ddeca commit 517ae97

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

github-cli.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ create_release(){
3232
}
3333

3434
upload_file(){
35-
curl --data-binary "@$SOURCE_FILE" -i -w '\n' -s -X POST \
36-
-H 'Content-Type: application/octet-stream' \
35+
local OUT=$(curl --data-binary "@$SOURCE_FILE" -w "\n%{http_code}\n" \
36+
-s -X POST -H 'Content-Type: application/octet-stream' \
3737
"https://uploads.github.com/repos/${USERNAME}/${REPOSITORY}/releases/$RELEASE_ID/assets?name=$TARGET_FILE&access_token=$REPO_TOKEN"
38+
)
39+
40+
if test "$(echo "$OUT" | tail -n 1)" -ne "201"; then
41+
echo -e "> Can't upload file: $TARGET_FILE \n $(echo ${OUT})"
42+
exit 2
43+
fi
3844
}
3945

4046
upload_files(){

0 commit comments

Comments
 (0)