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

This commit is contained in:
Brian Vaughn 2021-05-07 08:53:39 -04:00 committed by GitHub
parent 0a8fefca4c
commit e468072e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 14 deletions

View File

@ -5,9 +5,8 @@
const clear = require('clear');
const {join, relative} = require('path');
const theme = require('../theme');
const {getCommitFromCurrentBuild} = require('../utils');
module.exports = async () => {
module.exports = async ({build}) => {
const commandPath = relative(
process.env.PWD,
join(__dirname, '../download-experimental-build.js')
@ -15,13 +14,11 @@ module.exports = async () => {
clear();
const commit = await getCommitFromCurrentBuild();
const message = theme`
{caution An experimental build has been downloaded!}
You can download this build again by running:
{path ${commandPath}} --commit={commit ${commit}}
{path ${commandPath}} --build={build ${build}}
`;
console.log(message.replace(/\n +/g, '\n').trim());

View File

@ -17,10 +17,6 @@ const run = async () => {
try {
addDefaultParamValue('-r', '--releaseChannel', 'experimental');
// Default to the latest commit in master.
// If this is a reproducible build (e.g. Firefox tester) a --commit will be specified.
addDefaultParamValue(null, '--commit', 'master');
const params = await parseParams();
params.cwd = join(__dirname, '..', '..');
params.packages = await getPublicPackages(true);

View File

@ -51,8 +51,14 @@ const run = async ({build, cwd, releaseChannel}) => {
};
module.exports = async ({build, commit, cwd, releaseChannel}) => {
let buildLabel;
if (commit !== null) {
buildLabel = theme`commit {commit ${commit}} (build {build ${build}})`;
} else {
buildLabel = theme`build {build ${build}}`;
}
return logPromise(
run({build, cwd, releaseChannel}),
theme`Downloading artifacts from Circle CI for commit {commit ${commit}} (build {build ${build}})`
theme`Downloading artifacts from Circle CI for ${buildLabel}`
);
};

View File

@ -3,10 +3,18 @@
'use strict';
const commandLineArgs = require('command-line-args');
const getBuildIdForCommit = require('../get-build-id-for-commit');
const getBuildIdForCommit = require('./get-build-id-for-commit');
const theme = require('../theme');
const {logPromise} = require('../utils');
const paramDefinitions = [
{
name: 'build',
type: String,
description:
'CI build ID corresponding to the "process_artifacts_combined" task.',
defaultValue: null,
},
{
name: 'commit',
type: String,
@ -39,13 +47,20 @@ module.exports = async () => {
process.exit(1);
}
if (params.commit === null) {
console.error(theme.error`No --commit param specified.`);
if (params.build === null && params.commit === null) {
console.error(
theme.error`Either a --commit or --build param must be specified.`
);
process.exit(1);
}
try {
params.build = await getBuildIdForCommit(params.commit);
if (params.build === null) {
params.build = await logPromise(
getBuildIdForCommit(params.commit),
theme`Getting build ID for commit "${params.commit}"`
);
}
} catch (error) {
console.error(theme.error(error));
process.exit(1);