Updated release script to be Workflow aware (#15809)

This commit is contained in:
Brian Vaughn
2019-06-03 17:29:06 -07:00
committed by GitHub
parent dd43cb5fb9
commit b63a41d38a
2 changed files with 19 additions and 3 deletions
@@ -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});
@@ -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;