Created
October 31, 2021 17:31
-
-
Save phanirithvij2000/a94e19f193392d92df14e8a1ec470f2d to your computer and use it in GitHub Desktop.
Upload file to existing github release
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/9973056/curl-how-to-display-progress-information-while-uploading#comment104234143_41860083 | |
# https://stackoverflow.com/a/40216228/8608146 | |
# https://stackoverflow.com/a/69788901/8608146 | |
# https://unix.stackexchange.com/a/185039/312058 | |
filepath=$1 | |
filename=$(basename $filepath) | |
username=$2 | |
reponame=$3 | |
relid=$4 | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Content-Length: $(stat -f%z $filepath)" \ | |
-H "Content-Type: $(file -b --mime-type $filepath)" \ | |
-T "$filepath" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
https://uploads.github.com/repos/$username/$reponame/releases/$relid/assets?name=$filename | cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment