2020-08-15 19:46:53 +00:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
|
|
|
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
|
|
|
|
generate_post_data()
|
|
|
|
{
|
|
|
|
body=$(cat GitHubReleaseMessage.txt)
|
|
|
|
cat <<EOF
|
|
|
|
{
|
|
|
|
"tag_name": "build-${BUILD_SOURCEVERSION}",
|
2020-11-22 23:07:21 +00:00
|
|
|
"target_commitish": "${UPLOAD_COMMIT_HASH}",
|
2020-08-15 19:46:53 +00:00
|
|
|
"name": "${AVVER}",
|
|
|
|
"body": "$body",
|
|
|
|
"draft": false,
|
|
|
|
"prerelease": false
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
curl -s \
|
|
|
|
-H "Authorization: token ${RPCS3_TOKEN}" \
|
|
|
|
-H "Accept: application/vnd.github.v3+json" \
|
2020-11-22 23:07:21 +00:00
|
|
|
--data "$(generate_post_data)" "https://api.github.com/repos/$UPLOAD_REPO_FULL_NAME/releases" >> release.json
|
2020-08-15 19:46:53 +00:00
|
|
|
|
2020-08-16 00:44:08 +00:00
|
|
|
cat release.json
|
|
|
|
id=$(grep '"id"' release.json | cut -d ':' -f2 | head -n1 | awk '{$1=$1;print}')
|
2020-08-15 19:46:53 +00:00
|
|
|
id=${id%?}
|
2021-03-20 06:13:40 +00:00
|
|
|
echo "${id:?}"
|
2020-08-15 19:46:53 +00:00
|
|
|
|
|
|
|
upload_file()
|
|
|
|
{
|
|
|
|
curl -s \
|
|
|
|
-H "Authorization: token ${RPCS3_TOKEN}" \
|
|
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
|
|
-H "Content-Type: application/octet-stream" \
|
|
|
|
--data-binary @"$2"/"$3" \
|
2020-11-22 23:07:21 +00:00
|
|
|
"https://uploads.github.com/repos/$UPLOAD_REPO_FULL_NAME/releases/$1/assets?name=$3"
|
2020-08-15 19:46:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for file in "$ARTIFACT_DIR"/*; do
|
|
|
|
name=$(basename "$file")
|
|
|
|
upload_file "$id" "$ARTIFACT_DIR" "$name"
|
|
|
|
done
|