chore(cli): skip already published native packages (#2874)

Allow to retry failed CI jobs
This commit is contained in:
LongYinan 2025-08-13 21:16:04 -07:00 committed by GitHub
parent fe57c05d6b
commit db82372302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {