@@ -57,7 +57,7 @@ function doPublish() {
57
57
58
58
const assetUpdateUrl = `https://uploads.github.com/repos/microsoft/react-native/releases/{id}/assets?name=react-native-${ releaseVersion } .tgz` ;
59
59
const authHeader =
60
- "Basic " + new Buffer ( ":" + process . env . APIAUTHHEADER ) . toString ( "base64" ) ;
60
+ "Basic " + new Buffer ( ":" + process . env . SYSTEM_ACCESSTOKEN ) . toString ( "base64" ) ;
61
61
const userAgent = "Microsoft-React-Native-Release-Agent" ;
62
62
63
63
let uploadReleaseAssetUrl = "" ;
@@ -124,16 +124,30 @@ function doPublish() {
124
124
function ( err , res , body ) {
125
125
if ( err ) {
126
126
console . log ( err ) ;
127
- throw new Error ( "Error fetching release id. " ) ;
127
+ throw new Error ( "Error creating release" ) ;
128
128
}
129
129
130
130
console . log ( "Created GitHub Release: " + JSON . stringify ( body , null , 2 ) ) ;
131
- if ( body . id ) {
132
- uploadReleaseAssetUrl = assetUpdateUrl . replace ( / { i d } / , 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 ( / { i d } / , body . id ) ;
149
+ uploadTarBallToRelease ( ) ;
150
+ } ) ;
137
151
}
138
152
) ;
139
153
}
0 commit comments