Skip to content

Commit d7cf272

Browse files
committed
Publish fix
1 parent 41baf57 commit d7cf272

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.ado/publish.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function doPublish() {
5757

5858
const assetUpdateUrl = `https://uploads.github.com/repos/microsoft/react-native/releases/{id}/assets?name=react-native-${releaseVersion}.tgz`;
5959
const authHeader =
60-
"Basic " + new Buffer(":" + process.env.APIAUTHHEADER).toString("base64");
60+
"Basic " + new Buffer(":" + process.env.SYSTEM_ACCESSTOKEN).toString("base64");
6161
const userAgent = "Microsoft-React-Native-Release-Agent";
6262

6363
let uploadReleaseAssetUrl = "";
@@ -124,16 +124,30 @@ function doPublish() {
124124
function(err, res, body) {
125125
if (err) {
126126
console.log(err);
127-
throw new Error("Error fetching release id.");
127+
throw new Error("Error creating release");
128128
}
129129

130130
console.log("Created GitHub Release: " + JSON.stringify(body, null, 2));
131-
if (body.id) {
132-
uploadReleaseAssetUrl = assetUpdateUrl.replace(/{id}/, body.id);
133-
uploadTarBallToRelease();
134-
} else {
135-
console.warn('Unable to find release to upload tar...skipping custom tar for release.')
136-
}
131+
132+
request.get({
133+
url: `https://api.github.com/repos/microsoft/react-native/releases/tags/v${releaseVersion}`,
134+
headers: {
135+
"User-Agent": userAgent,
136+
Authorization: authHeader
137+
},
138+
json: true,
139+
},
140+
function(err, res, body) {
141+
if (err) {
142+
console.log(err);
143+
throw new Error("Error fetching release id.");
144+
}
145+
146+
console.log("Getting GitHub Release ID: " + JSON.stringify(body, null, 2));
147+
148+
uploadReleaseAssetUrl = assetUpdateUrl.replace(/{id}/, body.id);
149+
uploadTarBallToRelease();
150+
});
137151
}
138152
);
139153
}

.ado/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ jobs:
119119
BUILD_STAGINGDIRECTORY: $(Build.StagingDirectory)
120120
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
121121
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
122-
APIAUTHHEADER: $(apiAuthHeader)
123122

124123
- task: PublishBuildArtifacts@1
125124
displayName: 'Publish final artifacts'

0 commit comments

Comments
 (0)