@samitouri / QOS-React / commits / 838da52d67

[ci] Fix incorrect tags being pushed for compiler releases

ghstack-source-id: 812e49333ce19c3d13adb6cc87154fb83d7639b0 Pull Request resolved: https://github.com/facebook/react/pull/30620

Lauren Tan committed Aug 6, 2024 at 17:15 UTC 838da52d67a42295e05aad8d03f962129d9d88ff
1 file changed +23 -22
compiler/scripts/release/publish.js
+23 -22
@@ -61,9 +61,8 @@ async function main() {
61 })
62 .option('tags', {
63 description: 'Tags to publish to npm',
64 - type: 'choices',
65 - choices: ['experimental'],
66 - default: ['experimental'],
64 + type: 'string',
65 + default: 'experimental',
66 })
67 .help('help')
68 .parseSync();
@@ -178,27 +177,29 @@ async function main() {
177 spinner.succeed(`Successfully published ${pkgName} to npm`);
178
179 spinner.start('Pushing tags to npm');
181 - for (const tag of argv.tags) {
182 - try {
183 - let opts = ['dist-tag', 'add', `${pkgName}@${newVersion}`, tag];
184 - if (otp != null) {
185 - opts.push(`--otp=${otp}`);
180 + if (typeof argv.tags === 'string') {
181 + for (const tag of argv.tags.split(',')) {
182 + try {
183 + let opts = ['dist-tag', 'add', `${pkgName}@${newVersion}`, tag];
184 + if (otp != null) {
185 + opts.push(`--otp=${otp}`);
186 + }
187 + if (argv.debug === true) {
188 + spinner.info(`dry-run: npm ${opts.join(' ')}`);
189 + } else {
190 + await spawnHelper('npm', opts, {
191 + cwd: pkgDir,
192 + stdio: 'inherit',
193 + });
194 + }
195 + } catch (e) {
196 + spinner.fail(e.toString());
197 + throw e;
198 }
187 - if (argv.debug === true) {
188 - spinner.info(`dry-run: npm ${opts.join(' ')}`);
189 - } else {
190 - await spawnHelper('npm', opts, {
191 - cwd: pkgDir,
192 - stdio: 'inherit',
193 - });
194 - }
195 - } catch (e) {
196 - spinner.fail(e.toString());
197 - throw e;
199 + spinner.succeed(
200 + `Successfully pushed dist-tag ${tag} for ${pkgName} to npm`
201 + );
202 }
199 - spinner.succeed(
200 - `Successfully pushed dist-tag ${tag} for ${pkgName} to npm`
201 - );
203 }
204 }
205