@samitouri / QOS-React / commits / e468072e17

Updated release scripts to work around GitHub / Circle CI integration problems (#21434)

Brian Vaughn committed May 7, 2021 at 08:53 UTC e468072e17e3c2e70fa6eca46a074ff3f948c38a
5 files changed +28 -14
scripts/release/download-experimental-build-commands/print-summary.js
+2 -5
@@ -5,9 +5,8 @@
5 const clear = require('clear');
6 const {join, relative} = require('path');
7 const theme = require('../theme');
8 -const {getCommitFromCurrentBuild} = require('../utils');
8
10 -module.exports = async () => {
9 +module.exports = async ({build}) => {
10 const commandPath = relative(
11 process.env.PWD,
12 join(__dirname, '../download-experimental-build.js')
@@ -15,13 +14,11 @@ module.exports = async () => {
14
15 clear();
16
18 - const commit = await getCommitFromCurrentBuild();
19 -
17 const message = theme`
18 {caution An experimental build has been downloaded!}
19
20 You can download this build again by running:
24 - {path ${commandPath}} --commit={commit ${commit}}
21 + {path ${commandPath}} --build={build ${build}}
22 `;
23
24 console.log(message.replace(/\n +/g, '\n').trim());
scripts/release/download-experimental-build.js
-4
@@ -17,10 +17,6 @@ const run = async () => {
17 try {
18 addDefaultParamValue('-r', '--releaseChannel', 'experimental');
19
20 - // Default to the latest commit in master.
21 - // If this is a reproducible build (e.g. Firefox tester) a --commit will be specified.
22 - addDefaultParamValue(null, '--commit', 'master');
23 -
20 const params = await parseParams();
21 params.cwd = join(__dirname, '..', '..');
22 params.packages = await getPublicPackages(true);
scripts/release/shared-commands/download-build-artifacts.js
+7 -1
@@ -51,8 +51,14 @@ const run = async ({build, cwd, releaseChannel}) => {
51 };
52
53 module.exports = async ({build, commit, cwd, releaseChannel}) => {
54 + let buildLabel;
55 + if (commit !== null) {
56 + buildLabel = theme`commit {commit ${commit}} (build {build ${build}})`;
57 + } else {
58 + buildLabel = theme`build {build ${build}}`;
59 + }
60 return logPromise(
61 run({build, cwd, releaseChannel}),
56 - theme`Downloading artifacts from Circle CI for commit {commit ${commit}} (build {build ${build}})`
62 + theme`Downloading artifacts from Circle CI for ${buildLabel}`
63 );
64 };
scripts/release/shared-commands/get-build-id-for-commit.js renamed
scripts/release/shared-commands/parse-params.js
+19 -4
@@ -3,10 +3,18 @@
3 'use strict';
4
5 const commandLineArgs = require('command-line-args');
6 -const getBuildIdForCommit = require('../get-build-id-for-commit');
6 +const getBuildIdForCommit = require('./get-build-id-for-commit');
7 const theme = require('../theme');
8 +const {logPromise} = require('../utils');
9
10 const paramDefinitions = [
11 + {
12 + name: 'build',
13 + type: String,
14 + description:
15 + 'CI build ID corresponding to the "process_artifacts_combined" task.',
16 + defaultValue: null,
17 + },
18 {
19 name: 'commit',
20 type: String,
@@ -39,13 +47,20 @@ module.exports = async () => {
47 process.exit(1);
48 }
49
42 - if (params.commit === null) {
43 - console.error(theme.error`No --commit param specified.`);
50 + if (params.build === null && params.commit === null) {
51 + console.error(
52 + theme.error`Either a --commit or --build param must be specified.`
53 + );
54 process.exit(1);
55 }
56
57 try {
48 - params.build = await getBuildIdForCommit(params.commit);
58 + if (params.build === null) {
59 + params.build = await logPromise(
60 + getBuildIdForCommit(params.commit),
61 + theme`Getting build ID for commit "${params.commit}"`
62 + );
63 + }
64 } catch (error) {
65 console.error(theme.error(error));
66 process.exit(1);