mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
[build2 -> build] -> download-build-artifacts
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
const {exec} = require('child-process-promise');
|
||||
const {existsSync} = require('fs');
|
||||
const fse = require('fs-extra');
|
||||
const {join} = require('path');
|
||||
const {getArtifactsList, logPromise} = require('../utils');
|
||||
const theme = require('../theme');
|
||||
@@ -11,7 +12,7 @@ const theme = require('../theme');
|
||||
const run = async ({build, cwd, releaseChannel}) => {
|
||||
const artifacts = await getArtifactsList(build);
|
||||
const buildArtifacts = artifacts.find(entry =>
|
||||
entry.path.endsWith('build2.tgz')
|
||||
entry.path.endsWith('build.tgz')
|
||||
);
|
||||
|
||||
if (!buildArtifacts) {
|
||||
@@ -22,7 +23,7 @@ const run = async ({build, cwd, releaseChannel}) => {
|
||||
}
|
||||
|
||||
// Download and extract artifact
|
||||
await exec(`rm -rf ./build2`, {cwd});
|
||||
await exec(`rm -rf ./build`, {cwd});
|
||||
await exec(
|
||||
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
|
||||
{
|
||||
@@ -30,6 +31,11 @@ const run = async ({build, cwd, releaseChannel}) => {
|
||||
}
|
||||
);
|
||||
|
||||
// TODO: Currently storing a copy of the artifacts as `./build2`, because
|
||||
// some scripts reference that directory. Remove once we migrate everything to
|
||||
// reference `./build` instead.
|
||||
fse.copySync('./build', './build2');
|
||||
|
||||
// Copy to staging directory
|
||||
// TODO: Consider staging the release in a different directory from the CI
|
||||
// build artifacts: `./build/node_modules` -> `./staged-releases`
|
||||
@@ -50,7 +56,7 @@ const run = async ({build, cwd, releaseChannel}) => {
|
||||
console.error('Internal error: Invalid release channel: ' + releaseChannel);
|
||||
process.exit(releaseChannel);
|
||||
}
|
||||
await exec(`cp -r ./build2/${sourceDir} ./build/node_modules`, {cwd});
|
||||
await exec(`cp -r ./build/${sourceDir} ./build/node_modules`, {cwd});
|
||||
};
|
||||
|
||||
module.exports = async ({build, commit, cwd, releaseChannel}) => {
|
||||
|
||||
Reference in New Issue
Block a user