From db82372302da78aaa841e59cd761933326be1694 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 13 Aug 2025 21:16:04 -0700 Subject: [PATCH] chore(cli): skip already published native packages (#2874) Allow to retry failed CI jobs --- cli/src/api/pre-publish.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/cli/src/api/pre-publish.ts b/cli/src/api/pre-publish.ts index cc530232..2a31f3df 100644 --- a/cli/src/api/pre-publish.ts +++ b/cli/src/api/pre-publish.ts @@ -165,10 +165,26 @@ export async function prePublish(userOptions: PrePublishOptions) { } if (!options.skipOptionalPublish) { - execSync(`${npmClient} publish`, { - cwd: pkgDir, - env: process.env, - }) + try { + const output = execSync(`${npmClient} publish`, { + cwd: pkgDir, + env: process.env, + stdio: 'pipe', + }) + process.stdout.write(output) + } catch (e) { + if ( + e instanceof Error && + e.message.includes( + 'You cannot publish over the previously published versions', + ) + ) { + console.info(e.message) + debug.warn(`${pkgDir} has been published, skipping`) + } else { + throw e + } + } } if (options.ghRelease && repo && owner) {