@samitouri / QOS-React-2 / commits / b63a41d38a

Updated release script to be Workflow aware (#15809)

Brian Vaughn committed Jun 3, 2019 at 17:29 UTC b63a41d38a4e08b1a4831f8b210c548bee5b1aa3
2 files changed +19 -3
scripts/release/prepare-canary-commands/download-build-artifacts.js
+15 -2
@@ -16,9 +16,22 @@ const run = async ({build, cwd}) => {
16 process.env.CIRCLE_CI_API_TOKEN
17 }`;
18 const metadata = await http.get(metadataURL, true);
19 - const nodeModulesURL = metadata.find(
19 + const nodeModulesArtifact = metadata.find(
20 entry => entry.path === 'home/circleci/project/node_modules.tgz'
21 - ).url;
21 + );
22 +
23 + if (!nodeModulesArtifact) {
24 + console.log(
25 + theme`{error The specified build number does not contain any build artifacts}\n\n` +
26 + 'To get the correct build number from Circle CI, open the following URL:\n' +
27 + theme`{link https://circleci.com/gh/facebook/react/${build}}\n\n` +
28 + 'Select the "commit" Workflow at the top of the page, then select the "process_artifacts" job.'
29 + );
30 +
31 + process.exit(1);
32 + }
33 +
34 + const nodeModulesURL = nodeModulesArtifact.url;
35
36 if (!existsSync(join(cwd, 'build'))) {
37 await exec(`mkdir ./build`, {cwd});
scripts/release/prepare-canary-commands/get-latest-master-build-number.js
+4 -1
@@ -10,7 +10,10 @@ const run = async () => {
10 const metadataURL = `https://circleci.com/api/v1.1/project/github/facebook/react/tree/master`;
11 const metadata = await http.get(metadataURL, true);
12 const build = metadata.find(
13 - entry => entry.branch === 'master' && entry.status === 'success'
13 + entry =>
14 + entry.branch === 'master' &&
15 + entry.status === 'success' &&
16 + entry.workflows.job_name === 'process_artifacts'
17 ).build_num;
18
19 return build;