From feec8f1e62023db380fbbe1a624449f050fbfaf9 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 6 Aug 2024 17:15:56 -0400 Subject: [PATCH] [ci] Fix incorrect tags being pushed for compiler releases ghstack-source-id: 812e49333ce19c3d13adb6cc87154fb83d7639b0 Pull Request resolved: https://github.com/facebook/react/pull/30620 --- compiler/scripts/release/publish.js | 45 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/compiler/scripts/release/publish.js b/compiler/scripts/release/publish.js index 1b0b7377b2ccf..3262cbabd1509 100755 --- a/compiler/scripts/release/publish.js +++ b/compiler/scripts/release/publish.js @@ -61,9 +61,8 @@ async function main() { }) .option('tags', { description: 'Tags to publish to npm', - type: 'choices', - choices: ['experimental'], - default: ['experimental'], + type: 'string', + default: 'experimental', }) .help('help') .parseSync(); @@ -178,27 +177,29 @@ async function main() { spinner.succeed(`Successfully published ${pkgName} to npm`); spinner.start('Pushing tags to npm'); - for (const tag of argv.tags) { - try { - let opts = ['dist-tag', 'add', `${pkgName}@${newVersion}`, tag]; - if (otp != null) { - opts.push(`--otp=${otp}`); + if (typeof argv.tags === 'string') { + for (const tag of argv.tags.split(',')) { + try { + let opts = ['dist-tag', 'add', `${pkgName}@${newVersion}`, tag]; + if (otp != null) { + opts.push(`--otp=${otp}`); + } + if (argv.debug === true) { + spinner.info(`dry-run: npm ${opts.join(' ')}`); + } else { + await spawnHelper('npm', opts, { + cwd: pkgDir, + stdio: 'inherit', + }); + } + } catch (e) { + spinner.fail(e.toString()); + throw e; } - if (argv.debug === true) { - spinner.info(`dry-run: npm ${opts.join(' ')}`); - } else { - await spawnHelper('npm', opts, { - cwd: pkgDir, - stdio: 'inherit', - }); - } - } catch (e) { - spinner.fail(e.toString()); - throw e; + spinner.succeed( + `Successfully pushed dist-tag ${tag} for ${pkgName} to npm` + ); } - spinner.succeed( - `Successfully pushed dist-tag ${tag} for ${pkgName} to npm` - ); } }