Skip to content

Commit

Permalink
Updated release script to be Workflow aware (facebook#15809)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn authored Jun 4, 2019
1 parent dd43cb5 commit b63a41d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,22 @@ const run = async ({build, cwd}) => {
process.env.CIRCLE_CI_API_TOKEN
}`;
const metadata = await http.get(metadataURL, true);
const nodeModulesURL = metadata.find(
const nodeModulesArtifact = metadata.find(
entry => entry.path === 'home/circleci/project/node_modules.tgz'
).url;
);

if (!nodeModulesArtifact) {
console.log(
theme`{error The specified build number does not contain any build artifacts}\n\n` +
'To get the correct build number from Circle CI, open the following URL:\n' +
theme`{link https://circleci.com/gh/facebook/react/${build}}\n\n` +
'Select the "commit" Workflow at the top of the page, then select the "process_artifacts" job.'
);

process.exit(1);
}

const nodeModulesURL = nodeModulesArtifact.url;

if (!existsSync(join(cwd, 'build'))) {
await exec(`mkdir ./build`, {cwd});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const run = async () => {
const metadataURL = `https://circleci.com/api/v1.1/project/github/facebook/react/tree/master`;
const metadata = await http.get(metadataURL, true);
const build = metadata.find(
entry => entry.branch === 'master' && entry.status === 'success'
entry =>
entry.branch === 'master' &&
entry.status === 'success' &&
entry.workflows.job_name === 'process_artifacts'
).build_num;

return build;
Expand Down

0 comments on commit b63a41d

Please sign in to comment.