From c3709fa7444360588118613f050fec0292ad287b Mon Sep 17 00:00:00 2001 From: Zion Date: Sat, 15 Aug 2020 12:46:53 -0700 Subject: [PATCH] Manually upload Windows Github Release using curl. Actually fixes #7938 (#8715) For some reason Azure would evaluate the GitHub release instantly and complain about missing/invalid GitHub Release deployment and fail to even start the build, this fixes the issue by just manually uploading it via the GitHub API and curl. --- .ci/github-upload-windows.sh | 43 ++++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 14 +++--------- 2 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 .ci/github-upload-windows.sh diff --git a/.ci/github-upload-windows.sh b/.ci/github-upload-windows.sh new file mode 100644 index 0000000000..1daafcff2b --- /dev/null +++ b/.ci/github-upload-windows.sh @@ -0,0 +1,43 @@ +#!/bin/sh -ex + +ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY" +generate_post_data() +{ + body=$(cat GitHubReleaseMessage.txt) + cat <> release.json + +id=$(grep '"id"' release.json | cut -d ' ' -f4 | head -n1) +id=${id%?} +echo ${id:?} + +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" \ + "https://uploads.github.com/repos/$repo_full_name/releases/$1/assets?name=$3" +} + +for file in "$ARTIFACT_DIR"/*; do + name=$(basename "$file") + upload_file "$id" "$ARTIFACT_DIR" "$name" +done diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f17604e61..96f4956bc3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -100,16 +100,8 @@ jobs: condition: succeeded() artifact: RPCS3 for Windows - - task: GitHubRelease@1 + - bash: .ci/github-upload-windows.sh condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.Repository.Name'], 'RPCS3/rpcs3')) - inputs: - gitHubConnection: 'RPCS3-Token' - repositoryName: 'RPCS3/rpcs3-binaries-win' - releaseNotesFilePath: 'GitHubReleaseMessage.txt' - action: 'create' - target: '7d09e3be30805911226241afbb14f8cdc2eb054e' - tagSource: 'userSpecifiedTag' - tag: 'build-$(Build.SourceVersion)' - title: $(AVVER) - addChangeLog: false displayName: Push build to GitHub + env: + RPCS3_TOKEN: $(RPCS3-Token)